From b52e72f6e0f93f332e36dff84c1c3a3e14ad7c65 Mon Sep 17 00:00:00 2001 From: Mubbshar Anwar <78487564+mubbsharanwar@users.noreply.github.com> Date: Wed, 13 Aug 2025 17:46:17 +0500 Subject: [PATCH] fix: fix timezone utc for 52 (#37199) The django.utils.timezone.utc is removed in Django 5.1. issue: 37151 --- .../user_api/management/commands/email_opt_in_list.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py b/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py index 6bc4e96b1a..e7a7ac16e4 100644 --- a/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py +++ b/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py @@ -23,7 +23,7 @@ The command will always use the read replica database if one is configured. import contextlib import csv -import datetime +from datetime import datetime, timezone as dt_timezone import logging import os.path import time @@ -84,7 +84,7 @@ class Command(BaseCommand): QUERY_INTERVAL = 1000 # Default datetime if the user has not set a preference - DEFAULT_DATETIME_STR = datetime.datetime(year=2014, month=12, day=1).isoformat(' ') + DEFAULT_DATETIME_STR = datetime(year=2014, month=12, day=1).isoformat(' ') def handle(self, *args, **options): """ @@ -240,7 +240,7 @@ class Command(BaseCommand): user_id, username, email, full_name, course_id, is_opted_in, pref_set_datetime = row if pref_set_datetime: - pref_set_datetime = timezone.make_aware(pref_set_datetime, timezone.utc) + pref_set_datetime = timezone.make_aware(pref_set_datetime, dt_timezone.utc) else: pref_set_datetime = self.DEFAULT_DATETIME_STR