Hi Mike,
On 27 avr. 2012, at 14:51, Mike Yumatov wrote:
> I wrote a ticket about time zone warnings in date-based generic views:
> https://code.djangoproject.com/ticket/18217
It isn't necessary to notify django-developers when you create a ticket; that's
the job of django-updates.
> After some research, I understand that there are more problems with this
> views, than I thought at first. django.views.generic.dates module uses aware
> and naive datetime objects together, which breaks all date-based views except
> YearArchiveView.
>
> Let's have, for example:
> - America/Chicago as TIME_ZONE
> - an article, published at 2012-12-31 23:00:00 in local time zone (2012-01-01
> 05:00:00 UTC)
> - an url /articles/{year}/ which returns list of articles for requested year
> - an url /articles/{year}/{month}/ which returns list of articles for
> requested month
>
> As I understand, year and month must be in UTC in urls
They are in local time in the default time zone.
> or date_list from all date-based generic views is useless, because it
> contains dates in UTC.
I'm not sure I understand your point there.
> So, our article must be in /articles/2012/ and in /articles/2012/01/. But it
> won't be in /articles/2012/01/, because MonthArchiveView will use
> datetime.date objects, which will be treated as naive datetime.datetime
> object by ORM, and local time zone will be used.
This is an ill-defined problem, and also a hard one.
The behavior you're describing is the expected behavior, it's mostly backwards
compatible and in my opinion it's the least unreasonable option.
See also :
https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#faq
http://groups.google.com/group/django-developers/browse_thread/thread/cf0423bbb85b1bbf
Best regards,
--
Aymeric.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.