Switch away from deprecated django.utils.timezone.utc.
Review Request #14605 — Created Sept. 10, 2025 and updated
Once upon a time, Python didn't have good APIs for dealing with time
zones, and Django shipped their own utc helper. That changed, and
django.utils.timezone.utc
is scheduled for removal in 5.0 and raises a
warning. This change replaces it withdatetime.timezone.utc
Ran unit tests and no longer saw the warning.
Summary | ID |
---|---|
qrroqpqvtxmmkrwowqlwzkkpvkuzqkom |
Description | From | Last Updated |
---|---|---|
We have a bunch of different patterns for the two timezones and dealing with their naming conflicts. This change is … |
|
-
-
We have a bunch of different patterns for the two
timezone
s and dealing with their naming conflicts. This change is introducing another, and I think it'd be a good time to settle on what we want to do going forward.The pattern I've been leaning toward is to alias
datetime.timezone
astz
and keepdjango.utils.timezone
astimezone
, which gives us a consistenttimezone.now()
(which we use a lot) and thentz.utc
for that reference.
- Description:
-
Once upon a time, Python didn't have good APIs for dealing with time
zones, and Django shipped their own utc helper. That changed, and django.utils.timezone.utc
is scheduled for removal in 5.0 and raises a~ warning. This change replaces it with timezone.now()
~ warning. This change replaces it with datetime.timezone.utc
- Commits:
-
Summary ID qrroqpqvtxmmkrwowqlwzkkpvkuzqkom qrroqpqvtxmmkrwowqlwzkkpvkuzqkom