Opened 13 years ago

Closed 13 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: Aymeric Augustin
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

Description

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 Aymeric Augustin 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Aymeric Augustin, 13 years ago

Owner: changed from nobody to Aymeric Augustin
Triage Stage: UnreviewedAccepted

comment:2 by Aymeric Augustin, 13 years ago

Severity: NormalRelease blocker

by Aymeric Augustin, 13 years ago

Attachment: 17830.diff added

comment:3 by Aymeric Augustin, 13 years ago

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 by Jannis Leidel, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Aymeric Augustin, 13 years ago

Resolution: fixed
Status: newclosed

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