Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

Thanks gcc for the suggestion.

Backport of 9e5033b from master
  • Loading branch information...
commit f8d93f2c71f5a6dff349ec290f9ca6d7d316ba4f 1 parent deefdc8
Tim Graham timgraham authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 docs/topics/templates.txt
9 docs/topics/templates.txt
View
@@ -211,18 +211,23 @@ tags:
{% endfor %}
</ul>
-:ttag:`if` and ``else``
+:ttag:`if`, ``elif``, and ``else``
Evaluates a variable, and if that variable is "true" the contents of the
block are displayed::
{% if athlete_list %}
Number of athletes: {{ athlete_list|length }}
+ {% elif athlete_in_locker_room_list %}
+ Athletes should be out of the locker room soon!
{% else %}
No athletes.
{% endif %}
In the above, if ``athlete_list`` is not empty, the number of athletes
- will be displayed by the ``{{ athlete_list|length }}`` variable.
+ will be displayed by the ``{{ athlete_list|length }}`` variable. Otherwise,
+ if ``athlete_in_locker_room_list`` is not empty, the message "Athletes
+ should be out..." will be displayed. If both lists are empty,
+ "No athletes." will be displayed.
You can also use filters and various operators in the :ttag:`if` tag::
Please sign in to comment.
Something went wrong with that request. Please try again.