The default date format in Django admin is YYYY-MM-DD, I would like to change it to DD-MM-YYYY. Based on an answer to a similar question I could update the validators to accept the new format, but if I opened an existing object, the date was still shown as YYYY-MM-DD and the JS date picker returned dates in this format, too. How to overcome these issues?
Asked
Active
Viewed 1,237 times
0
-
1Do you have USE_L10N = True? – dirkgroten Apr 29 '19 at 16:08
-
Yes, I do have `USE_L10N = True`. However, if necessary perhaps I can turn it off. – Eerik Sven Puudist Apr 29 '19 at 17:27
1 Answers
0
After you set USE_L10N = False
, add this
DATE_INPUT_FORMATS = [
'%d-%m-%Y', '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y',
'%b %d %Y', '%b %d, %Y',
'%d %b %Y', '%d %b, %Y',
'%B %d %Y', '%B %d, %Y',
'%d %B %Y', '%d %B, %Y',
]
Change the first format if you want something else. Documentation

STIKO
- 1,995
- 1
- 10
- 9