суббота, 2 июня 2012 г., 1:05:01 UTC+4 пользователь Aymeric Augustin 
написал:
>
> On 1 juin 2012, at 20:56, Artem Andreev wrote: 
> > I should converts a lot of manually, which increases the possibility of 
> error. Maybe this is just my experience. 
>
> You should be able to control this problem with a function or class that 
> handles all you AJAX responses. When you say "AJAX", I suppose you're 
> returning JSON. This function would walk through the datastructure, find 
> datetimes, and convert them to local time, before serializing in JSON. 
>

Thanks, Aymeric.

Of course, I can create something like function localize_datetimes and use 
it in JSONResponseMixin and all places where I send data to external 
systems.
But such function, JSONResponseMixin, etc should implement all django users 
who works with AJAX and external systems that expects datetime naive.
Other solution - if database layer and timezone.now() will return datetimes 
with active timezone. IMHO such solution more friendly to django users.
I understand that I am a little late to this discussion. And such cases can 
affect not so much django users.
Perhaps it would be better to wait a feedback from other users.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/rEEsepqSq1kJ.
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