Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#17263 closed Cleanup/optimization (fixed)

When time zone support is active, raise a warning when a naive datetime reaches the database adapter

Reported by: Aymeric Augustin Owned by: Aymeric Augustin
Component: Database layer (models, ORM) Version:
Severity: Release blocker Keywords:
Cc: anssi.kaariainen@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I haven't done it because I thought it would be too obnoxious -- for instance, if you're using a third-party app that uses datetimes in a non-trivial way and hasn't been upgraded yet.

But a good argument in favor of such a warning was made on the mailing list, and it's easy to filter the warning out with one line in your settings file if you don't care.

Attachments (1)

17263.patch (6.5 KB) - added by Aymeric Augustin 7 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by Luke Plant

Severity: NormalRelease blocker
Triage Stage: Design decision neededAccepted

Agreed, and in fact I think we should ensure this gets in for 1.4, so that we can mention it in the upgrading notes, therefore making it a release blocker.

comment:2 Changed 7 years ago by Anssi Kääriäinen

Cc: anssi.kaariainen@… added

comment:3 Changed 7 years ago by Aymeric Augustin

Adding this warning shows that Django still uses naive datetimes in many places, including the cache framework, the date based generic views, the "auth" and "comments" contrib apps.

Changed 7 years ago by Aymeric Augustin

Attachment: 17263.patch added

comment:4 Changed 7 years ago by Aymeric Augustin

Has patch: set

Attached patch adds a warning (with docs and tests).

comment:5 Changed 7 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

In [17117]:

(The changeset message doesn't reference this ticket)

comment:6 Changed 7 years ago by Aymeric Augustin

In [17126]:

Ensured that the warning added at r17117 also applies to queryset filter arguments. Refs #17263.

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