Fixed #12199 -- Added the ability to use "as" with the firstof template tag.

This commit is contained in:
Craig Oldford 2015-04-13 12:27:30 -03:00 committed by Tim Graham
parent 6023312dde
commit 75bc5bc634
4 changed files with 31 additions and 4 deletions

View file

@ -285,6 +285,13 @@ Or if only some variables should be escaped, you can use::
{% firstof var1 var2|safe var3 "<strong>fallback value</strong>"|safe %}
You can use the syntax ``{% firstof var1 var2 var3 as value %}`` to store the
output inside a variable.
.. versionadded:: 1.9
The "as" syntax was added.
.. templatetag:: for
for

View file

@ -208,6 +208,9 @@ Templates
* A warning will now be logged for missing context variables. These messages
will be logged to the :ref:`django.template <django-template-logger>` logger.
* The :ttag:`firstof` template tag supports storing the output in a variable
using 'as'.
Requests and Responses
^^^^^^^^^^^^^^^^^^^^^^