Update all datetime/timezone usage to avoid deprecated functionality.
Review Request #13429 — Created Nov. 22, 2023 and submitted
Django has deprecated
django.utils.timezone.utcin favor of
datetime.timezone.utc. The rest of thedjango.utils.timezonemethods
are still supported. Furthermore,datetime.timezone.utccannot be
directly imported, and must be accessed throughdatetime.timezone.This leaves two possible importable targets named
datetime(both
datetimeanddatetime.datetime) and namedtimezone
(datetime.timezoneanddjango.utils.timezone), all of which are
relevant.In an effort to keep things sane and consistent, the codebase now
imports the top-leveldatetime(accessing everything as a direct
property access of that) anddjango.utils.timezoneastimezonein
all affected modules. We may opt to go this route with all new Django
code going forward.With this change, all datetime-related warnings in unit tests have been
removed.
All unit tests pass.
| Summary | ID |
|---|---|
| e1093159b55a9e930fa00e5652f560fabc034dbd |
| Description | From | Last Updated |
|---|---|---|
|
Looks like you missed this one, this should be changed to just import datetime and the rest of the code … |
|
- Change Summary:
-
Updated
test_dates.pyfor the singleimport datetime. - Commits:
-
Summary ID 720afe31512de096f1684b44d3ed7c5e83ab6e8c e1093159b55a9e930fa00e5652f560fabc034dbd - Diff:
-
Revision 2 (+104 -90)