#21747 closed Cleanup/optimization (fixed)
The {% elif %} templatetag could use documentation
| Reported by: | Chris Wilson | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.6 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
The Django templates page makes no mention of the {% elif %} tag, although it does document {% if %} and {% else %}.
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.
Change History (3)
comment:1 by , 12 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | New feature → Cleanup/optimization |
comment:2 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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-tagsThese 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.