Date format localization problem (Django displays dates in format it doesn't accept)

470 views
Skip to first unread message

Ludwik Trammer

unread,
May 28, 2010, 10:50:53 AM5/28/10
to django-d...@googlegroups.com
Hi,

There is quite a serious problem with Django 1.2's format localization
and forms. At first I noticed Djnago ignores L10N date formats when
displaying dates in form fields, but calendar widgets in admin don't.
So when you try using the calendar, date format goes back and forth
between localized and unlocalized versions. I opened a ticket couple
of days ago (#13591) calling it an "usability" problem (because it is
utterly confusing to have a date format changing, when the only thing
you expected to be changed was a date).

It turned out however, that the issue is much more serious (and not
contained to Django Admin only). Look at the StackOverflow question:

http://stackoverflow.com/questions/2929388/django-1-2-dates-in-admin-forms-dont-work-with-locales-i10ntrue

It turnes out date formats for some countries, shipped with Django,
doesn't include the "universal" YYYY-MM-DD formats as accepted date
format (DATE_INPUT_FORMATS). Which at first seems logical, but in
conjunction with the fact that Django always uses the YYYY-MM-DD
format to display dates in forms, ignoring localization settings, the
result is people are getting form validating errors, when trying to
edit their models. In other words Django populates form fields with
data in format it doesn't accept itself.

Ludwik Trammer

Horst Gutmann

unread,
May 28, 2010, 11:20:44 AM5/28/10
to django-d...@googlegroups.com
Did you already try the patch I attached at
http://code.djangoproject.com/ticket/13621 ? Perhaps this solves your
problem too :-)

> --
> You received this message because you are subscribed to the Google Groups "Django developers" group.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to django-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
>
>

Jeliuc Alexandr

unread,
Jun 14, 2010, 3:07:14 PM6/14/10
to Django developers
Hello Horst! :)
Thank You for this patch. It was very helpful


On May 28, 6:20 pm, Horst Gutmann <ze...@zerokspot.com> wrote:
> Did you already try the patch I attached athttp://code.djangoproject.com/ticket/13621? Perhaps this solves your
> problem too :-)
>
>
>
> On Fri, May 28, 2010 at 4:50 PM, Ludwik Trammer <lud...@trammer.pl> wrote:
> > Hi,
>
> > There is quite a serious problem with Django 1.2's format localization
> > and forms. At first I noticed Djnago ignores L10N date formats when
> > displaying dates in form fields, but calendar widgets in admin don't.
> > So when you try using the calendar, date format goes back and forth
> > between localized and unlocalized versions. I opened a ticket couple
> > of days ago (#13591) calling it an "usability" problem (because it is
> > utterly confusing to have a date format changing, when the only thing
> > you expected to be changed was a date).
>
> > It turned out however, that the issue is much more serious (and not
> > contained to Django Admin only). Look at the StackOverflow question:
>
> >http://stackoverflow.com/questions/2929388/django-1-2-dates-in-admin-...
Reply all
Reply to author
Forward
0 new messages