From what I have read FORMAT_MODULE_PATH
allows to use custom formats.
How can I access the first value from DATETIME_INPUT_FORMATS
in my application?
The DATETIME_INPUT_FORMATS
variable for german should be '%d.%m.%Y'
, whereas for english should be '%Y-%m-%d'
. I want to use the values from the formats.py files depending on the language.
I followed the Django documentation for how to use the FORMAT_MODULE_PATH
variable, but I don't get the expected results.
settings.py:
USE_L10N = True
USE_I18N = True
FORMAT_MODULE_PATH = 'myproject.formats'
myproject/
formats/
__init__.py
en/
__init__.py
formats.py
de/
__init__.py
formats.py
I change the browser's language from English to German, and back and nothing happens with the date format. It is always '%Y-%m-%d'
. The displayed date format is the value of settings.DATE_INPUT_FORMATS[0]
.
Django version is 1.2.5 and Python version is 2.5.4.