Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #16404 -- Fixed a regression in the localization changes in the…

… humanize app made in r16168. Thanks,

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent cf70c96 commit 944ef3bb60eae989aa7d536e509f9cc80be0adcb @jezdez jezdez committed
2  django/contrib/humanize/templatetags/
@@ -41,7 +41,7 @@ def intcomma(value, use_l10n=True):
except (TypeError, ValueError):
return intcomma(value, False)
- return number_format(value)
+ return number_format(value, force_grouping=True)
orig = force_unicode(value)
new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig)
if orig == new:
3  django/utils/
@@ -103,7 +103,7 @@ def time_format(value, format=None, use_l10n=None):
return dateformat.time_format(value, get_format(format or 'TIME_FORMAT', use_l10n=use_l10n))
-def number_format(value, decimal_pos=None, use_l10n=None):
+def number_format(value, decimal_pos=None, use_l10n=None, force_grouping=False):
Formats a numeric value using localization settings
@@ -120,6 +120,7 @@ def number_format(value, decimal_pos=None, use_l10n=None):
get_format('NUMBER_GROUPING', lang, use_l10n=use_l10n),
get_format('THOUSAND_SEPARATOR', lang, use_l10n=use_l10n),
+ force_grouping=force_grouping
def localize(value, use_l10n=None):
4 django/utils/
@@ -2,7 +2,7 @@
from django.utils.safestring import mark_safe
-def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep=''):
+def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', force_grouping=False):
Gets a number (as a number or string), and returns it as a string,
using formats definied as arguments:
@@ -13,7 +13,7 @@ def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep=''):
* thousand_sep: Thousand separator symbol (for example ",")
- use_grouping = settings.USE_L10N and \
+ use_grouping = force_grouping or settings.USE_L10N and \
settings.USE_THOUSAND_SEPARATOR and grouping
# Make the common case fast:
if isinstance(number, int) and not use_grouping and not decimal_pos:

0 comments on commit 944ef3b

Please sign in to comment.
Something went wrong with that request. Please try again.