Opened 5 years ago

Closed 5 years ago

Last modified 5 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: aaugustin Owned by: aaugustin
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 aaugustin 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by lukeplant

  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Design decision needed to Accepted

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 5 years ago by akaariai

  • Cc anssi.kaariainen@… added

comment:3 Changed 5 years ago by aaugustin

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 5 years ago by aaugustin

comment:4 Changed 5 years ago by aaugustin

  • Has patch set

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

comment:5 Changed 5 years ago by aaugustin

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

In [17117]:

(The changeset message doesn't reference this ticket)

comment:6 Changed 5 years ago by aaugustin

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