From 2112879305d0c78bdb7460e55f70591c89790e39 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 8 Aug 2015 08:12:53 -0400 Subject: [PATCH] [1.8.x] Refs #25236 -- Discouraged use of ifequal/ifnotequal template tags. Backport of 787cc7aa843d5c0834f56b5f8ae03b86ce553c51 from master --- docs/ref/templates/builtins.txt | 43 ++++++--------------------------- docs/spelling_wordlist | 2 -- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index cecdee3a4a..e19ad8ff82 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -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 }} {% 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 diff --git a/docs/spelling_wordlist b/docs/spelling_wordlist index f8fb27a9d7..c1c2ba60e7 100644 --- a/docs/spelling_wordlist +++ b/docs/spelling_wordlist @@ -286,8 +286,6 @@ iendswith ies iexact ifchanged -ifequal -ifnotequal iframe inbox Incompliance