18👍
✅
{% if leg.drivers %}
will always be true, because this will be a many to many manager.
Try {% if leg.drivers.all %}
to get all associated drivers.
1👍
The for … empty template tag is made for this. Simply loop leg.drivers.all and if you want to display some message if there are no drivers, then you can do so in the empty clause.
- Python logging to multiple files
- Pillow installation error: command 'gcc' failed with exit status 1
- Django REST-Auth Password Reset
- Load Balancing Multiple Django Webservers
Source:stackexchange.com