listing objects from ManyToManyField listing objects from ManyToManyField django django

listing objects from ManyToManyField


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 %}


Similar inside pythoncode this would be:

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