Django 1.2: Dates in admin forms don't work with Locales (I10N=True)

Posted by equalium on Stack Overflow See other posts from Stack Overflow or by equalium
Published on 2010-05-28T13:33:36Z Indexed on 2010/05/28 15:01 UTC
Read the original article Hit count: 152

Filed under:
|
|
|

I have an application in Django 1.2. Language is selectable (I18N and Locale = True)

When I select the english lang. in the site, the admin works OK. But when I change to any other language this is what happens with date inputs (spanish example):

Correctly, the input accepts the spanish format %d/%m/%Y (Even selecting from the calendar, the date inserts as expected). But when I save the form and load it again, the date shows in the english form: %Y-%m-%d

The real problem is that when I load the form to change any other text field and try to save it I get an error telling me to enter a valid date, so I have to write all dates again or change the language in the site to use the admin.

I haven't specified anything for DATE_INPUT_FORMATS in settings nor have I overridden forms or models.

Surely I am missing something but I can't find it. Can anybody give me a hint?

© Stack Overflow or respective owner

Related posts about python

Related posts about django