Skip to content Skip to sidebar Skip to footer

Question On Django: Displaying Many To Many Fields

I seem to have a problem with Django when it comes Rendering ManyToManyField in a template. I can make it work partially, but I cannot make it work properly as I want it. Firstly I

Solution 1:

The content of {{invoice.work_orders.all} is a list of Work_Order objects.
If you want to print them, you should iterate the list:

{% for invoice in invoice.work_orders.all %}
  {{invoice}}<br />
{% endfor %}

Post a Comment for "Question On Django: Displaying Many To Many Fields"