diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2020-10-11 23:34:32 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-10-13 10:36:46 +0200 |
| commit | ac6c4260074de43a978e5c6553ef89441e1d6748 (patch) | |
| tree | c87ab944899912a643447c519e2cf684a31d4720 /docs | |
| parent | e18156b6c35908f2a4026287b5225a6a4da8af1a (diff) | |
Fixed #20601 -- Allowed forcing format with thousand separators in floatformat filter.
Thanks Claude Paroz and Nick Pope for reviews.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/templates/builtins.txt | 16 | ||||
| -rw-r--r-- | docs/releases/3.2.txt | 3 |
2 files changed, 18 insertions, 1 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 54258155bd..7fd44b01d7 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -1732,6 +1732,18 @@ displayed. For example: ``34.26000`` ``{{ value|floatformat:"-3" }}`` ``34.260`` ============ ================================ ========== +If the argument passed to ``floatformat`` has the ``g`` suffix, it will force +grouping by the :setting:`THOUSAND_SEPARATOR` for the active locale. For +example, when the active locale is ``en`` (English): + +============ ================================= ============= +``value`` Template Output +============ ================================= ============= +``34232.34`` ``{{ value|floatformat:"2g" }}`` ``34,232.34`` +``34232.06`` ``{{ value|floatformat:"g" }}`` ``34,232.1`` +``34232.00`` ``{{ value|floatformat:"-3g" }}`` ``34,232`` +============ ================================= ============= + Using ``floatformat`` with no argument is equivalent to using ``floatformat`` with an argument of ``-1``. @@ -1740,6 +1752,10 @@ with an argument of ``-1``. In older versions, a negative zero ``-0`` was returned for negative numbers which round to zero. +.. versionchanged:: 3.2 + + The ``g`` suffix to force grouping by thousand separators was added. + .. templatefilter:: force_escape ``force_escape`` diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 5ab05a1dba..f4ef77e435 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -367,7 +367,8 @@ Signals Templates ~~~~~~~~~ -* ... +* :tfilter:`floatformat` template filter now allows using the ``g`` suffix to + force grouping by the :setting:`THOUSAND_SEPARATOR` for the active locale. Tests ~~~~~ |
