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 /tests | |
| 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 'tests')
| -rw-r--r-- | tests/i18n/other/locale/fr/__init__.py | 0 | ||||
| -rw-r--r-- | tests/i18n/other/locale/fr/formats.py | 2 | ||||
| -rw-r--r-- | tests/i18n/tests.py | 5 |
3 files changed, 7 insertions, 0 deletions
diff --git a/tests/i18n/other/locale/fr/__init__.py b/tests/i18n/other/locale/fr/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/i18n/other/locale/fr/__init__.py diff --git a/tests/i18n/other/locale/fr/formats.py b/tests/i18n/other/locale/fr/formats.py new file mode 100644 index 0000000000..d13e245c30 --- /dev/null +++ b/tests/i18n/other/locale/fr/formats.py @@ -0,0 +1,2 @@ +# A user-defined format +CUSTOM_DAY_FORMAT = 'd/m/Y CUSTOM' diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index db16eaf5e2..573a722f56 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -1248,6 +1248,11 @@ class FormattingTests(SimpleTestCase): def test_format_arbitrary_settings(self): self.assertEqual(get_format('DEBUG'), 'DEBUG') + def test_get_custom_format(self): + with self.settings(FORMAT_MODULE_PATH='i18n.other.locale'): + with translation.override('fr', deactivate=True): + self.assertEqual('d/m/Y CUSTOM', get_format('CUSTOM_DAY_FORMAT')) + class MiscTests(SimpleTestCase): |
