summaryrefslogtreecommitdiff
path: root/docs/templates.txt
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2006-06-19 15:23:57 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2006-06-19 15:23:57 +0000
commitadf4b9311d5d64a2bdd58da50271c121ea22e397 (patch)
treea69b3b023595cf1ce67a14c4c1ecd3290d94088e /docs/templates.txt
parente976ed1f7910fad03704f88853c5c5b36cbab134 (diff)
multi-auth: Merged to [3151]archive/attic/multi-auth
git-svn-id: http://code.djangoproject.com/svn/django/branches/multi-auth@3152 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/templates.txt')
-rw-r--r--docs/templates.txt30
1 files changed, 22 insertions, 8 deletions
diff --git a/docs/templates.txt b/docs/templates.txt
index c191b409f4..5f397c5a60 100644
--- a/docs/templates.txt
+++ b/docs/templates.txt
@@ -454,8 +454,12 @@ displayed by the ``{{ athlete_list|length }}`` variable.
As you can see, the ``if`` tag can take an option ``{% else %}`` clause that
will be displayed if the test fails.
-``if`` tags may use ``or`` or ``not`` to test a number of variables or to negate
-a given variable::
+``if`` tags may use ``and``, ``or`` or ``not`` to test a number of variables or
+to negate a given variable::
+
+ {% if athlete_list and coach_list %}
+ Both athletes and coaches are available.
+ {% endif %}
{% if not athlete_list %}
There are no athletes.
@@ -468,16 +472,24 @@ a given variable::
{% if not athlete_list or coach_list %}
There are no athletes or there are some coaches (OK, so
writing English translations of boolean logic sounds
- stupid; it's not my fault).
+ stupid; it's not our fault).
+ {% endif %}
+
+ {% if athlete_list and not coach_list %}
+ There are some athletes and absolutely no coaches.
{% endif %}
-For simplicity, ``if`` tags do not allow ``and`` clauses; use nested ``if``
-tags instead::
+``if`` tags don't allow ``and`` and ``or`` clauses within the same tag, because
+the order of logic would be ambiguous. For example, this is invalid::
+
+ {% if athlete_list and coach_list or cheerleader_list %}
+
+If you need to combine ``and`` and ``or`` to do advanced logic, just use nested
+``if`` tags. For example::
{% if athlete_list %}
- {% if coach_list %}
- Number of athletes: {{ athlete_list|length }}.
- Number of coaches: {{ coach_list|length }}.
+ {% if coach_list or cheerleader_list %}
+ We have athletes, and either coaches or cheerleaders!
{% endif %}
{% endif %}
@@ -754,6 +766,8 @@ The argument tells which template bit to output:
``closeblock`` ``%}``
``openvariable`` ``{{``
``closevariable`` ``}}``
+ ``openbrace`` ``{``
+ ``closebrace`` ``}``
================== =======
widthratio