From f9bfcd1131dc3b851e9bee94332d493c50f9c8e5 Mon Sep 17 00:00:00 2001 From: Perry Roper Date: Wed, 6 Dec 2023 00:08:48 +0700 Subject: [PATCH] Use datetime.timezone.utc as Django 5.0 removed the alias. --- django_rq/templatetags/django_rq.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django_rq/templatetags/django_rq.py b/django_rq/templatetags/django_rq.py index a9a0ac9e..63e5eab0 100644 --- a/django_rq/templatetags/django_rq.py +++ b/django_rq/templatetags/django_rq.py @@ -1,3 +1,5 @@ +import datetime + from django import template from django.utils import timezone from django.utils.html import escape @@ -10,7 +12,7 @@ def to_localtime(time): """Converts naive datetime to localtime based on settings""" - utc_time = time.replace(tzinfo=timezone.utc) + utc_time = time.replace(tzinfo=datetime.timezone.utc) to_zone = timezone.get_default_timezone() return utc_time.astimezone(to_zone)