Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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 Marc Tamlyn, 10 years ago

Triage Stage: UnreviewedAccepted
Type: New featureCleanup/optimization

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.

comment:2 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 9e5033b302676856901a7808910fcab5c3fe1d27:

Fixed #21747 -- Added {% elif %} to template topics guide.

Thanks gcc for the suggestion.

comment:3 by Tim Graham <timograham@…>, 10 years ago

In f8d93f2c71f5a6dff349ec290f9ca6d7d316ba4f:

[1.6.x] Fixed #21747 -- Added {% elif %} to template topics guide.

Thanks gcc for the suggestion.

Backport of 9e5033b302 from master

Note: See TracTickets for help on using tickets.
Back to Top