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
- [Django]-Detect mobile, tablet or Desktop on Django
- [Django]-How to use if/else condition on Django Templates?
- [Django]-How do I migrate a model out of one django app and into a new one?
Source:stackexchange.com