summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2021-04-22 16:55:59 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-07-23 12:36:21 +0200
commit4d4bf55e0ea849476f7e3abfeb018c338f18a9b4 (patch)
tree3eef7f8e90252c2f4f2c7ca9a07992af005e1744 /docs
parent2fac0a18081dcc77fc860c801e5d727dc90435b3 (diff)
Fixed #33864 -- Deprecated length_is template filter.
Diffstat (limited to 'docs')
-rw-r--r--docs/internals/deprecation.txt2
-rw-r--r--docs/ref/templates/builtins.txt2
-rw-r--r--docs/releases/4.2.txt15
3 files changed, 19 insertions, 0 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index 160605ddcd..43c7a0fee9 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -22,6 +22,8 @@ details on these changes.
* The ``AlterIndexTogether`` migration operation will be removed. A stub
operation will remain for compatibility with historical migrations.
+* The ``length_is`` template filter will be removed.
+
.. _deprecation-removed-in-5.0:
5.0
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index c4b83a8be8..13a8694ad6 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -1906,6 +1906,8 @@ The filter returns ``0`` for an undefined variable.
``length_is``
-------------
+.. deprecated:: 4.2
+
Returns ``True`` if the value's length is the argument, or ``False`` otherwise.
For example::
diff --git a/docs/releases/4.2.txt b/docs/releases/4.2.txt
index 413e9a9471..0846f05e2c 100644
--- a/docs/releases/4.2.txt
+++ b/docs/releases/4.2.txt
@@ -317,3 +317,18 @@ Miscellaneous
for using Python's :py:mod:`secrets` module to generate passwords.
* The ``AlterIndexTogether`` migration operation is deprecated.
+
+* The ``length_is`` template filter is deprecated in favor of :tfilter:`length`
+ and the ``==`` operator within an :ttag:`{% if %}<if>` tag. For example
+
+ .. code-block:: html+django
+
+ {% if value|length == 4 %}…{% endif %}
+ {% if value|length == 4 %}True{% else %}False{% endif %}
+
+ instead of:
+
+ .. code-block:: html+django
+
+ {% if value|length_is:4 %}…{% endif %}
+ {{ value|length_is:4 }}