mirror of
https://github.com/django/django.git
synced 2025-07-19 17:19:12 +00:00
[1.9.x] Corrected firstof template tag's docstring.
Since Django 1.8, firstof escapes its output. Backport of fff5dbe59ca629c295480693f045f03537858eee from master
This commit is contained in:
parent
2ff72962a6
commit
040d6055a2
@ -756,7 +756,7 @@ def do_filter(parser, token):
|
|||||||
@register.tag
|
@register.tag
|
||||||
def firstof(parser, token):
|
def firstof(parser, token):
|
||||||
"""
|
"""
|
||||||
Outputs the first variable passed that is not False, without escaping.
|
Outputs the first variable passed that is not False.
|
||||||
|
|
||||||
Outputs nothing if all the passed variables are False.
|
Outputs nothing if all the passed variables are False.
|
||||||
|
|
||||||
@ -767,11 +767,11 @@ def firstof(parser, token):
|
|||||||
This is equivalent to::
|
This is equivalent to::
|
||||||
|
|
||||||
{% if var1 %}
|
{% if var1 %}
|
||||||
{{ var1|safe }}
|
{{ var1 }}
|
||||||
{% elif var2 %}
|
{% elif var2 %}
|
||||||
{{ var2|safe }}
|
{{ var2 }}
|
||||||
{% elif var3 %}
|
{% elif var3 %}
|
||||||
{{ var3|safe }}
|
{{ var3 }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
but obviously much cleaner!
|
but obviously much cleaner!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user