Skip to content

Commit

Permalink
Django v5.0: django.utils.timezone.utc alias to datetime.timezone.utc…
Browse files Browse the repository at this point in the history
… is removed

https://docs.djangoproject.com/en/5.0/releases/5.0/#features-removed-in-5-0
> The `django.utils.timezone.utc` alias to `datetime.timezone.utc` is removed.
  • Loading branch information
cclauss authored and auvipy committed Dec 19, 2023
1 parent ae1b422 commit f66796b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django_celery_beat/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Utilities."""
# -- XXX This module must not use translation as that causes
# -- a recursive loader import!
from datetime import timezone as datetime_timezone

from django.conf import settings
from django.utils import timezone

Expand All @@ -17,7 +19,7 @@ def make_aware(value):
if getattr(settings, 'USE_TZ', False):
# naive datetimes are assumed to be in UTC.
if timezone.is_naive(value):
value = timezone.make_aware(value, timezone.utc)
value = timezone.make_aware(value, datetime_timezone.utc)
# then convert to the Django configured timezone.
default_tz = timezone.get_default_timezone()
value = timezone.localtime(value, default_tz)
Expand Down

0 comments on commit f66796b

Please sign in to comment.