I was curious so I went digging in the source, and discovered that {% elif
%} is implemented. It even has doc comments:
{{{
{% if athlete_list %}
Number of athletes: {{ athlete_list|count }}
{% elif athlete_in_locker_room_list %}
Athletes should be out of the locker room soon!
{% else %}
No athletes.
{% endif %}
}}}
It would be great to have it officially documented on the Templates page.
--
Ticket URL: <https://code.djangoproject.com/ticket/21747>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* type: New feature => Cleanup/optimization
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
The `{% elif %}` tag is documented as part of the `{% if %}` documentation
in the reference docs:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#ref-
templates-builtins-tags
These are quite heavily linked to from the section you mention, but I
guess it wouldn't hurt to amend one of the examples there to include an
`elif`.
--
Ticket URL: <https://code.djangoproject.com/ticket/21747#comment:1>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"9e5033b302676856901a7808910fcab5c3fe1d27"]:
{{{
#!CommitTicketReference repository=""
revision="9e5033b302676856901a7808910fcab5c3fe1d27"
Fixed #21747 -- Added {% elif %} to template topics guide.
Thanks gcc for the suggestion.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21747#comment:2>
Comment (by Tim Graham <timograham@…>):
In [changeset:"f8d93f2c71f5a6dff349ec290f9ca6d7d316ba4f"]:
{{{
#!CommitTicketReference repository=""
revision="f8d93f2c71f5a6dff349ec290f9ca6d7d316ba4f"
[1.6.x] Fixed #21747 -- Added {% elif %} to template topics guide.
Thanks gcc for the suggestion.
Backport of 9e5033b302 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21747#comment:3>