summaryrefslogtreecommitdiff
path: root/django/utils/numberformat.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2018-07-19 22:44:40 +0200
committerTim Graham <timograham@gmail.com>2018-07-19 16:44:40 -0400
commit0adfba968e28cfb4e4d681e658866debbbd68089 (patch)
tree929348b9e9b562b45deb0c8b7b748259f5e74471 /django/utils/numberformat.py
parent6b6bdfe25c946ee9512b3866d64930fe1be619fd (diff)
Fixed #29578 -- Made numberformat.format() honor forced l10n usage.
Thanks Sassan Haradji for the report.
Diffstat (limited to 'django/utils/numberformat.py')
-rw-r--r--django/utils/numberformat.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
index 4dc37ae22b..9c0496342d 100644
--- a/django/utils/numberformat.py
+++ b/django/utils/numberformat.py
@@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
- force_grouping=False):
+ force_grouping=False, use_l10n=None):
"""
Get a number (as a number or string), and return it as a string,
using formats defined as arguments:
@@ -18,7 +18,7 @@ def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
module in locale.localeconv() LC_NUMERIC grouping (e.g. (3, 2, 0)).
* thousand_sep: Thousand separator symbol (for example ",")
"""
- use_grouping = settings.USE_L10N and settings.USE_THOUSAND_SEPARATOR
+ use_grouping = (use_l10n or (use_l10n is None and settings.USE_L10N)) and settings.USE_THOUSAND_SEPARATOR
use_grouping = use_grouping or force_grouping
use_grouping = use_grouping and grouping != 0
# Make the common case fast