20
In the Django template language is there away to use the the else clause with a for loop? I relies I can use an if check before the for loop but that gets repetitive.
python for-else
list = []
for i in list:
print i
else:
print 'list is empty'
Django template for-else (my guess)
<h1>{{ game.title}}</h1>
<table>
<tr>
{% for platform in game.platform_set.all %}
<td>{{ platform.system }} -- ${{ platform.price}}</td>
{% else %}
<td>No Platforms</td>
{% endfor %}
</tr>
</table>
<a href="{% url 'video_games:profile' game.id %}"></a>