1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #25812 -- Restored the ability to use custom formats with the date template filter.

This commit is contained in:
Gagaro
2015-11-25 12:17:59 +01:00
committed by Tim Graham
parent ab33269b00
commit 34d88944f4
7 changed files with 19 additions and 6 deletions

View File

@@ -110,8 +110,6 @@ def get_format(format_type, lang=None, use_l10n=None):
be localized (or not), overriding the value of settings.USE_L10N.
"""
format_type = force_str(format_type)
if format_type not in FORMAT_SETTINGS:
return format_type
if use_l10n or (use_l10n is None and settings.USE_L10N):
if lang is None:
lang = get_language()
@@ -120,9 +118,6 @@ def get_format(format_type, lang=None, use_l10n=None):
cached = _format_cache[cache_key]
if cached is not None:
return cached
else:
# Return the general setting by default
return getattr(settings, format_type)
except KeyError:
for module in get_format_modules(lang):
try:
@@ -137,6 +132,9 @@ def get_format(format_type, lang=None, use_l10n=None):
except AttributeError:
pass
_format_cache[cache_key] = None
if format_type not in FORMAT_SETTINGS:
return format_type
# Return the general setting by default
return getattr(settings, format_type)
get_format_lazy = lazy(get_format, six.text_type, list, tuple)