Skip to content

Commit

Permalink
[1.9.x] Corrected firstof template tag's docstring.
Browse files Browse the repository at this point in the history
Since Django 1.8, firstof escapes its output.

Backport of fff5dbe from master
  • Loading branch information
solarissmoke authored and timgraham committed Jun 21, 2016
1 parent 2ff7296 commit 040d605
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions django/template/defaulttags.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def do_filter(parser, token):
@register.tag
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.
Expand All @@ -767,11 +767,11 @@ def firstof(parser, token):
This is equivalent to::
{% if var1 %}
{{ var1|safe }}
{{ var1 }}
{% elif var2 %}
{{ var2|safe }}
{{ var2 }}
{% elif var3 %}
{{ var3|safe }}
{{ var3 }}
{% endif %}
but obviously much cleaner!
Expand Down

0 comments on commit 040d605

Please sign in to comment.