Ticket #22171: thousands.diff

File thousands.diff, 817 bytes (added by Klaas van Schelven, 11 years ago)
  • django/utils/formats.py

    diff --git a/django/utils/formats.py b/django/utils/formats.py
    index e283490..7bbbcd3 100644
    a b  
    11import decimal
    22import datetime
     3import re
    34
    45from django.conf import settings
    56from django.utils import dateformat, numberformat, datetime_safe
    def sanitize_separators(value):  
    183184                value, decimals = value.split(decimal_separator, 1)
    184185                parts.append(decimals)
    185186            if settings.USE_THOUSAND_SEPARATOR:
    186                 parts.append(value.replace(get_format('THOUSAND_SEPARATOR'), ''))
     187                parts.append(re.sub(r'[%s]([0-9]{3})' % get_format('THOUSAND_SEPARATOR'), r'\1', value))
    187188            else:
    188189                parts.append(value)
    189190            value = '.'.join(reversed(parts))
Back to Top