Re: DateTimeField received a naive datetime (2013-01-10 00:00:00) while time zone support is active.
On Fri, Jan 11, 2013 at 12:23:17AM -0800, Jeff Hsu wrote: > Hi all, > >I kept getting DateTimeField received a naive datetime (2013-01-10 > 00:00:00) while time zone support is active. but I can't figure out where > it's receiving a naive datetime. I have USE_TZ set to True in my setting > file(stores timezone aware object in mysql?). My url is as below: You get some good tips for configuration and tracebak on this post: http://note.harajuku-tech.org/datetimefield-received-a-naive-datetime-while Iñigo > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/q3z2y6RI3x4J. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: DateTimeField received a naive datetime (2013-01-10 00:00:00) while time zone support is active.
On Fri, Jan 11, 2013 at 8:23 AM, Jeff Hsu <jyhsu1...@gmail.com> wrote: > Hi all, > >I kept getting DateTimeField received a naive datetime (2013-01-10 > 00:00:00) while time zone support is active. but I can't figure out where > it's receiving a naive datetime. I have USE_TZ set to True in my setting > file(stores timezone aware object in mysql?). My url is as below: > > urlpatterns = patterns('django.views.generic.date_based', #add the > repetitive pattern here > url(r'^$', 'archive_index', entry_info_dict, > name='coltrane_entry_archive_index'), > url(r'^(?P\d{4})/$','archive_year', entry_info_dict, > name='coltrane_entry_archive_year'), > url(r'^(?P\d{4})/(?P\w{3})/$','archive_month', > entry_info_dict, > name='coltrane_entry_archive_month'), > url(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$','archive_day', > entry_info_dict, > name='coltrane_entry_archive_day'), > > url(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$', > 'object_detail', entry_info_dict, name='coltrane_entry_detail'), > #the forth arg will this patter a name > #[-\w] will match letter, number or a hyphen > ) > > Every time I access a detail page from the archive index page, the error > will pop out. I'm using generic view to do my detail page, and I can figure > out what's wrong. Can anybody give me some direction? > > http://dpaste.com/871999/ > > Thank you, > Jeff > Function based generic views were deprecated in 1.3, TZ support appeared in 1.4. When a date based generic view is asked to filter against a DateTimeField, it takes the specified day, and filters that field is between datetime.combine(date, time.min) and datetime.combine(date, time.max). datetime.combine only returns TZ aware datetimes if the time supplied is TZ aware (time.min/time.max are not). I suggest you update to use the class based generic views that arrived in 1.3: https://docs.djangoproject.com/en/1.4/topics/generic-views-migration/ Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
DateTimeField received a naive datetime (2013-01-10 00:00:00) while time zone support is active.
Hi all, I kept getting DateTimeField received a naive datetime (2013-01-10 00:00:00) while time zone support is active. but I can't figure out where it's receiving a naive datetime. I have USE_TZ set to True in my setting file(stores timezone aware object in mysql?). My url is as below: urlpatterns = patterns('django.views.generic.date_based', #add the repetitive pattern here url(r'^$', 'archive_index', entry_info_dict, name='coltrane_entry_archive_index'), url(r'^(?P\d{4})/$','archive_year', entry_info_dict, name='coltrane_entry_archive_year'), url(r'^(?P\d{4})/(?P\w{3})/$','archive_month', entry_info_dict, name='coltrane_entry_archive_month'), url(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$','archive_day', entry_info_dict, name='coltrane_entry_archive_day'), url(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$', 'object_detail', entry_info_dict, name='coltrane_entry_detail'), #the forth arg will this patter a name #[-\w] will match letter, number or a hyphen ) Every time I access a detail page from the archive index page, the error will pop out. I'm using generic view to do my detail page, and I can figure out what's wrong. Can anybody give me some direction? http://dpaste.com/871999/ Thank you, Jeff -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/q3z2y6RI3x4J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.