3388 shaares
This is a customized version of the default for template tag which takes an optional {% else %} clause that will be displayed if the given array is empty.
from django.template import *
t1 = Template("""
{% load mytags %}
{% for athlete in athlete_list %}
{{ athlete }}
{% else %}
No athlete in list!
{% endfor %}
""")
c1 = Context(
{'athlete_list':
['me ...