[Django]-Listing objects from ManyToManyField

107👍

You need to call all on the many-to-many field to get an iterable object. Also, the next line should contain the speaker rather than conference.speakers.

{% for speaker in conference.speakers.all %}
        <li>{{ speaker }}</li>
{% endfor %}

23👍

Similar inside pythoncode this would be:

for speaker in conferenece.speakers.all():
  print speaker.FIELDNAME

Leave a comment