Opened 4 years ago

Closed 4 years ago

#17830 closed Bug (fixed)

DateFieldListFilter "Past 7 days" filter uses naive datetime when USE_TZ is set.

Reported by: Glenn Washburn <development@…> Owned by: aaugustin
Component: contrib.admin Version: 1.4-beta-1
Severity: Release blocker Keywords:
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


The "Past 7 days" link for the DateFieldListFilter always contains a serialized naive datetime. This becomes a problem when USE_TZ is set because that value with get parsed back into a naive datetime and used directly in a QuerySet.filter call. The warning about using a naive data time will be raised.

Attachments (1)

17830.diff (9.6 KB) - added by aaugustin 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 4 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to aaugustin
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by aaugustin

  • Severity changed from Normal to Release blocker

Changed 4 years ago by aaugustin

comment:3 Changed 4 years ago by aaugustin

  • Has patch set

To fix this problem, I had to modify DateFieldListFilter to avoid the __year, __month and __day lookups -- because of #17260, these don't work well when time zone support is enabled.

comment:4 Changed 4 years ago by jezdez

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 4 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

In [17670]:

Fixed #17830 -- Modified list_filter on DateTimeFields to account for the new time zone support. Thanks Glenn Washburn for the report and Jannis Leidel for the review.

Note: See TracTickets for help on using tickets.
Back to Top