Ticket #3100: django_elif_docs.diff

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

Docs for the new {% elif %} tag

  • docs/ref/templates/builtins.txt

    diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
    index 51ef03c..16f1820 100644
    a b displayed by the ``{{ athlete_list|length }}`` variable. 
    313313As you can see, the ``if`` tag can take an optional ``{% else %}`` clause that
    314314will be displayed if the test fails.
    315315
     316.. versionadded:: 1.2
     317
     318If you have multiple conditions to check against, you may wish to use
     319the ``elif`` tag::
     320
     321    {% if athlete_list %}
     322        Number of athletes: {{ athlete_list|length }}
     323    {% elif athletes_in_lockerroom %}
     324        There are some athletes queued in the locker room, but they
     325        should be out soon!
     326    {% else %}
     327        No athletes.
     328    {% endif %}
     329
    316330Boolean operators
    317331^^^^^^^^^^^^^^^^^
    318332
Back to Top