[1.8.x] Refs #25236 -- Discouraged use of ifequal/ifnotequal template tags.

Backport of 787cc7aa84 from master
This commit is contained in:
Tim Graham 2015-08-08 08:12:53 -04:00
parent 43a05a93e9
commit 2112879305
2 changed files with 8 additions and 37 deletions

View File

@ -561,6 +561,14 @@ If you need different precedence, you will need to use nested :ttag:`if` tags.
Sometimes that is better for clarity anyway, for the sake of those who do not
know the precedence rules.
``ifequal`` and ``ifnotequal``
""""""""""""""""""""""""""""""
``{% ifequal a b %} ... {% endifequal %}`` is an obsolete way to write
``{% if a == b %} ... {% endif %}``. Likewise, ``{% ifnotequal a b %} ...
{% endifnotequal %}`` is superseded by ``{% if a != b %} ... {% endif %}``.
The ``ifequal`` and ``ifnotequal`` tags will be deprecated in a future release.
.. templatetag:: ifchanged
ifchanged
@ -606,41 +614,6 @@ will be displayed if the value has not changed::
">{{ match }}</div>
{% endfor %}
.. templatetag:: ifequal
ifequal
^^^^^^^
Output the contents of the block if the two arguments equal each other.
Example::
{% ifequal user.pk comment.user_id %}
...
{% endifequal %}
As in the :ttag:`if` tag, an ``{% else %}`` clause is optional.
The arguments can be hard-coded strings, so the following is valid::
{% ifequal user.username "adrian" %}
...
{% endifequal %}
An alternative to the ``ifequal`` tag is to use the :ttag:`if` tag and the
``==`` operator.
.. templatetag:: ifnotequal
ifnotequal
^^^^^^^^^^
Just like :ttag:`ifequal`, except it tests that the two arguments are not
equal.
An alternative to the ``ifnotequal`` tag is to use the :ttag:`if` tag and
the ``!=`` operator.
.. templatetag:: include
include

View File

@ -286,8 +286,6 @@ iendswith
ies
iexact
ifchanged
ifequal
ifnotequal
iframe
inbox
Incompliance