Django ORM, Forms and custom select input look
Some thing that confused me. Have a simple model (Employee) with one FK to
User Django model. In my templates, i used custom field output for
customization of field look in form:
<select ...>
{% for employee in form.accept_employee.field.choices %}
<option value="{{ employee.0 }}">{{ employee.1 }}</option>
{% endfor %}
</select>
This used to create another Ticket model with FK to Employee, user should
select one from the list. But with django-debug-toolbar i see 2 identical
sql request "select * from employees" for that template instead of just
one when i use something like this
{{ form.accept_employee }}
in template. Can anybody explain why this happend?
No comments:
Post a Comment