mirror of https://github.com/django/django.git
Fixed #311 -- Small change to docstring. Thanks, rmunn
git-svn-id: http://code.djangoproject.com/svn/django/trunk@496 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
bf108187a2
commit
2c3067b5e5
|
@ -387,9 +387,9 @@ def do_firstof(parser, token):
|
||||||
Sample usage::
|
Sample usage::
|
||||||
|
|
||||||
{% firstof var1 var2 var3 %}
|
{% firstof var1 var2 var3 %}
|
||||||
|
|
||||||
This is equivalent to::
|
This is equivalent to::
|
||||||
|
|
||||||
{% if var1 %}
|
{% if var1 %}
|
||||||
{{ var1 }}
|
{{ var1 }}
|
||||||
{% else %}{% if var2 %}
|
{% else %}{% if var2 %}
|
||||||
|
@ -397,7 +397,7 @@ def do_firstof(parser, token):
|
||||||
{% else %}{% if var3 %}
|
{% else %}{% if var3 %}
|
||||||
{{ var3 }}
|
{{ var3 }}
|
||||||
{% endif %}{% endif %}{% endif %}
|
{% endif %}{% endif %}{% endif %}
|
||||||
|
|
||||||
but obviously much cleaner!
|
but obviously much cleaner!
|
||||||
"""
|
"""
|
||||||
bits = token.contents.split()[1:]
|
bits = token.contents.split()[1:]
|
||||||
|
@ -471,15 +471,15 @@ def do_if(parser, token):
|
||||||
The ``{% if %}`` tag evaluates a variable, and if that variable is "true"
|
The ``{% if %}`` tag evaluates a variable, and if that variable is "true"
|
||||||
(i.e. exists, is not empty, and is not a false boolean value) the contents
|
(i.e. exists, is not empty, and is not a false boolean value) the contents
|
||||||
of the block are output:
|
of the block are output:
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
{% if althlete_list %}
|
{% if althlete_list %}
|
||||||
Number of athletes: {{ althete_list|count }}
|
Number of athletes: {{ althete_list|count }}
|
||||||
{% else %}
|
{% else %}
|
||||||
No athletes.
|
No athletes.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
In the above, if ``athlete_list`` is not empty, the number of athletes will
|
In the above, if ``athlete_list`` is not empty, the number of athletes will
|
||||||
be displayed by the ``{{ athlete_list|count }}`` variable.
|
be displayed by the ``{{ athlete_list|count }}`` variable.
|
||||||
|
|
||||||
|
@ -488,24 +488,24 @@ def do_if(parser, token):
|
||||||
|
|
||||||
``if`` tags may use ``or`` or ``not`` to test a number of variables or to
|
``if`` tags may use ``or`` or ``not`` to test a number of variables or to
|
||||||
negate a given variable::
|
negate a given variable::
|
||||||
|
|
||||||
{% if not athlete_list %}
|
{% if not athlete_list %}
|
||||||
There are no athletes.
|
There are no athletes.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if athlete_list or coach_list %}
|
{% if athlete_list or coach_list %}
|
||||||
There are some athletes or some coaches.
|
There are some athletes or some coaches.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if not athlete_list or coach_list %}
|
{% if not athlete_list or coach_list %}
|
||||||
There are no athletes or there are some coaches (OK, so
|
There are no athletes or there are some coaches (OK, so
|
||||||
writing English translations of boolean logic sounds
|
writing English translations of boolean logic sounds
|
||||||
stupid; it's not my fault).
|
stupid; it's not my fault).
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
For simplicity, ``if`` tags do not allow ``and`` clauses; use nested ``if``
|
For simplicity, ``if`` tags do not allow ``and`` clauses; use nested ``if``
|
||||||
tags instead::
|
tags instead::
|
||||||
|
|
||||||
{% if athlete_list %}
|
{% if athlete_list %}
|
||||||
{% if coach_list %}
|
{% if coach_list %}
|
||||||
Number of athletes: {{ athlete_list|count }}.
|
Number of athletes: {{ athlete_list|count }}.
|
||||||
|
@ -637,7 +637,7 @@ def do_regroup(parser, token):
|
||||||
* Margaret Thatcher
|
* Margaret Thatcher
|
||||||
* Colendeeza Rice
|
* Colendeeza Rice
|
||||||
* Unknown:
|
* Unknown:
|
||||||
* Janet Reno
|
* Pat Smith
|
||||||
|
|
||||||
The following snippet of template code would accomplish this dubious task::
|
The following snippet of template code would accomplish this dubious task::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue