Code

Ticket #3100: django_elif_docs.diff

File django_elif_docs.diff, 817 bytes (added by cwebber, 5 years ago)

Docs for the new {% elif %} tag

Line 
1diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
2index 51ef03c..16f1820 100644
3--- a/docs/ref/templates/builtins.txt
4+++ b/docs/ref/templates/builtins.txt
5@@ -313,6 +313,20 @@ displayed by the ``{{ athlete_list|length }}`` variable.
6 As you can see, the ``if`` tag can take an optional ``{% else %}`` clause that
7 will be displayed if the test fails.
8 
9+.. versionadded:: 1.2
10+
11+If you have multiple conditions to check against, you may wish to use
12+the ``elif`` tag::
13+
14+    {% if athlete_list %}
15+        Number of athletes: {{ athlete_list|length }}
16+    {% elif athletes_in_lockerroom %}
17+        There are some athletes queued in the locker room, but they
18+        should be out soon!
19+    {% else %}
20+        No athletes.
21+    {% endif %}
22+
23 Boolean operators
24 ^^^^^^^^^^^^^^^^^
25