Hi I can’t get DATE_FORMAT, DATE_INPUT_FORMATS, or any related settings to work. Django doesn’t appear to recognise my settings either when displaying dates in the template or using form fields. This appears to be a new issue as I recently migrated to Django 5 and didn’t encounter it before.
Relevant settings:
DATE_FORMAT = "d.m.Y"
DATETIME_FORMAT = "d.m.Y P"
SHORT_DATETIME_FORMAT = DATETIME_FORMAT
DATE_INPUT_FORMATS = [
"%d.%m.%Y",
"%d.%m.%y",
"%d/%m/%Y",
"%d-%m-%Y",
"%d/%m/%y",
"%d-%m-%y",
]
DATETIME_INPUT_FORMATS = [
"%d.%m.%Y %H:%M:%S",
"%d.%m.%y %H:%M:%S",
]
USE_I18N = False
USE_L10N = False
USE_TZ = False
This problem also appears in the Django shell. e.g.:
>>> from django.utils.timezone import now
>>> from django.template import Context, Template
>>> Template('{{ d|date:"DATE_FORMAT" }}').render(Context({'d':now}))
'May 2, 2024'
>>> from django.conf import settings
>>> settings.DATE_FORMAT
'd.m.Y'
Does anybody know what is going wrong here?