mitsuhiko/jinja2 — Issue #77: Can we get an {% empty %} tag?
Author: nbv4
Created: 2011-12-02 16:33:58+00:00
State: open

Django has this really cool tag called {% empty %}, which lets you do this:

{% for item in list %}

{{ item }}

{% empty %}

Nothing to show!

{% endfor %}

which is short for

{% if list %}
{% for item in list %}

{{ item }}
{% endfor %}
{% else %}

Nothing to show!

{% endif %}

Since switching to jinja, I have really missed this tag :(