Code

Opened 2 years ago

Closed 2 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

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 aaugustin 2 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 2 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 2 years ago by aaugustin

  • Severity changed from Normal to Release blocker

Changed 2 years ago by aaugustin

comment:3 Changed 2 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 2 years ago by jezdez

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 2 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.