#31590 closed Bug (fixed)
Admin date_hierarchy crashes on datetime field with no data
Reported by: | Kyle | Owned by: | Kyle |
---|---|---|---|
Component: | contrib.admin | Version: | 3.1 |
Severity: | Release blocker | Keywords: | date_hierarchy |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Change History (5)
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 5 years ago
Has patch: | set |
---|
comment:3 by , 5 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Ready for checkin |
Patch LGTM pending two cosmetic adjustments.
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/12916