diff options
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 ~~~~~ |
