Ticket #14042: date_format_settings_fix.diff

File date_format_settings_fix.diff, 1.2 KB (added by Ben Davis, 14 years ago)
  • django/utils/formats.py

     
    7979    Checks if value is a localizable type (date, number...) and returns it
    8080    formatted as a string using current locale format
    8181    """
    82     if settings.USE_L10N:
    83         if isinstance(value, (decimal.Decimal, float, int)):
    84             return number_format(value)
    85         elif isinstance(value, datetime.datetime):
    86             return date_format(value, 'DATETIME_FORMAT')
    87         elif isinstance(value, datetime.date):
    88             return date_format(value)
    89         elif isinstance(value, datetime.time):
    90             return time_format(value, 'TIME_FORMAT')
     82    if isinstance(value, (decimal.Decimal, float, int)):
     83        return number_format(value)
     84    elif isinstance(value, datetime.datetime):
     85        return date_format(value, 'DATETIME_FORMAT')
     86    elif isinstance(value, datetime.date):
     87        return date_format(value)
     88    elif isinstance(value, datetime.time):
     89        return time_format(value, 'TIME_FORMAT')
    9190    return value
    9291
    9392def localize_input(value, default=None):
Back to Top