#31590: Admin date_hierarchy crashes on datetime field with no data
-----------------------------------------+--------------------------------
               Reporter:  kjpc-tech      |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  contrib.admin  |        Version:  3.1
               Severity:  Normal         |       Keywords:  date_hierarchy
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+--------------------------------
 Just upgraded to Django 3.1 alpha and ran into this issue. It looks like
 its related to commit 55cdf6c52db07f29128741b8734a523ed042e465. When there
 is no data in the admin or all values are null, a date hierarchy on a
 datetime field will cause a crash.


 {{{
 File "django/contrib/admin/templatetags/admin_list.py", line 386, in
 date_hierarchy
   for k, v in date_range.items()
 File "django/contrib/admin/templatetags/admin_list.py", line 386, in
 <dictcomp>
   for k, v in date_range.items()
 File "django/utils/timezone.py", line 212, in is_aware
   return value.utcoffset() is not None

 Exception Value: 'NoneType' object has no attribute 'utcoffset'
 }}}


 I'm starting work on a fix.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31590>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.a246d898ae8839ae86664c605d882718%40djangoproject.com.

Reply via email to