Switch away from deprecated django.utils.timezone.utc.

Review Request #14605 — Created Sept. 10, 2025 and updated

Information

Review Board
release-7.1.x

Reviewers

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 datetime.timezone.utc

Ran unit tests and no longer saw the warning.

Summary ID
Switch away from deprecated django.utils.timezone.utc.
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()` Testing Done: Ran unit tests and no longer saw the warning.
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 …

chipx86chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. Show all issues

    We have a bunch of different patterns for the two timezones 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 as tz and keep django.utils.timezone as timezone, which gives us a consistent timezone.now() (which we use a lot) and then tz.utc for that reference.

  3. 
      
david
Review request changed
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
Switch away from deprecated django.utils.timezone.utc.
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()` Testing Done: Ran unit tests and no longer saw the warning.
qrroqpqvtxmmkrwowqlwzkkpvkuzqkom
Switch away from deprecated django.utils.timezone.utc.
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()` Testing Done: Ran unit tests and no longer saw the warning.
qrroqpqvtxmmkrwowqlwzkkpvkuzqkom

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
maubin
  1. Ship It!
  2.