summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-08 08:37:27 +0200
committerGitHub <noreply@github.com>2021-09-08 08:37:27 +0200
commit4a43335d300da942602fbf216cd0a53b60827ab4 (patch)
tree0fa559e6c92066934e0c79cada2293b986e56e29 /docs
parent301a85a12f3c2c9427c7ff581fd4683bab1f29f6 (diff)
Fixed #30086, Refs #32873 -- Made floatformat template filter independent of USE_L10N.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/templates/builtins.txt19
-rw-r--r--docs/releases/4.0.txt7
2 files changed, 25 insertions, 1 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 936c80cdb5..baf0608a40 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -1736,6 +1736,18 @@ example, when the active locale is ``en`` (English):
``34232.00`` ``{{ value|floatformat:"-3g" }}`` ``34,232``
============ ================================= =============
+Output is always localized (independently of the :ttag:`{% localize off %}
+<localize>` tag) unless the argument passed to ``floatformat`` has the ``u``
+suffix, which will force disabling localization. For example, when the active
+locale is ``pl`` (Polish):
+
+============ ================================= =============
+``value`` Template Output
+============ ================================= =============
+``34.23234`` ``{{ value|floatformat:"3" }}`` ``34,232``
+``34.23234`` ``{{ value|floatformat:"3u" }}`` ``34.232``
+============ ================================= =============
+
Using ``floatformat`` with no argument is equivalent to using ``floatformat``
with an argument of ``-1``.
@@ -1743,6 +1755,13 @@ with an argument of ``-1``.
The ``g`` suffix to force grouping by thousand separators was added.
+.. versionchanged:: 4.0
+
+ ``floatformat`` template filter no longer depends on the
+ :setting:`USE_L10N` setting and always returns localized output.
+
+ The ``u`` suffix to force disabling localization was added.
+
.. templatefilter:: force_escape
``force_escape``
diff --git a/docs/releases/4.0.txt b/docs/releases/4.0.txt
index 88b3c8ac37..7ae566d43a 100644
--- a/docs/releases/4.0.txt
+++ b/docs/releases/4.0.txt
@@ -355,7 +355,8 @@ Signals
Templates
~~~~~~~~~
-* ...
+* :tfilter:`floatformat` template filter now allows using the ``u`` suffix to
+ force disabling localization.
Tests
~~~~~
@@ -574,6 +575,10 @@ Miscellaneous
<overriding-built-in-widget-templates>` with the appropriate template from
Django 3.2.
+* The :tfilter:`floatformat` template filter no longer depends on the
+ :setting:`USE_L10N` setting and always returns localized output. Use the
+ ``u`` suffix to disable localization.
+
.. _deprecated-features-4.0:
Features deprecated in 4.0