In django I have a form and one of the fields is a Many-to-Many field. For this Many-to-Many field I am displaying each item as a Checkbox instead of a multiple selector. As I iterate over the M-2-M field I need to know what the value for each item is.
{% for employee in form.employees %}
{{ employee.id}}
{% endfor %}
In this example form.employees is just a queryset of all the employees and as I iterate over them I need to know what their id is.
Aucun commentaire:
Enregistrer un commentaire