diff options
| author | Gagaro <gagaro42@gmail.com> | 2015-11-25 12:17:59 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-11-28 08:44:41 -0500 |
| commit | 08e1c79f7ae574ed27a93e97a0a56c3fcba3aa68 (patch) | |
| tree | 5e3c70e200cc7e64de4721be77b670e6809bf947 /django | |
| parent | b5ff75dab8f9ffaeaaddc027568cfc7a6d279a04 (diff) | |
[1.9.x] Fixed #25812 -- Restored the ability to use custom formats with the date template filter.
Backport of 34d88944f46d3e2734488fd0ca3c2c24c15a0264 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/utils/formats.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/django/utils/formats.py b/django/utils/formats.py index 0ae8989409..d09003c72b 100644 --- a/django/utils/formats.py +++ b/django/utils/formats.py @@ -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) |
