Hi all,

This may be a bug in Django.

We have a lot of forms and datetimefields. Apparently, DateTimeInput
objects are initialized right after the first page load of the server,
where self.format for this instance is set according to the current
language.
DateTimeInput._format_value, which is called during rendering, will
see self.is_localized to be False, and render the data using the
language which happened to be used during the startup of the
application.

is_localized is passed from DateTimeField to Field to DateTimeInput.

For ModelForms, it's no option to pass localize=True for every input
element, and Field will always fallback to localize=False

In combination with localeurl, this bug causes unexpected behaviour,
all datetimefields will render dates according to the language of the
first request after the server has been started.


Feedback about how to work fix or work around this issue is welcome :)

Cheers,
Jonathan

I propose that Field.__init__ should have localize=None, and if no
localize parameter has been given, set self.localize according to
USE_L10N in the settings.

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

Reply via email to