From cfe81cd834b9cd73fc4c7f608a16166fbc606823 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Thu, 15 Jul 2021 00:37:15 +0500 Subject: [PATCH] Django3 has removed python_2_unicode_compatible. Execute the codemodes on this file and removed all usage. --- lms/djangoapps/courseware/models.py | 7 +------ openedx/core/djangoapps/api_admin/models.py | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lms/djangoapps/courseware/models.py b/lms/djangoapps/courseware/models.py index 2a7e581e9f..9b86c33959 100644 --- a/lms/djangoapps/courseware/models.py +++ b/lms/djangoapps/courseware/models.py @@ -22,7 +22,7 @@ from django.conf import settings from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.db import models from django.db.models.signals import post_save -from django.utils.encoding import python_2_unicode_compatible + from django.utils.translation import ugettext_lazy as _ from model_utils.models import TimeStampedModel from opaque_keys.edx.django.models import BlockTypeKeyField, CourseKeyField, LearningContextKeyField, UsageKeyField @@ -74,7 +74,6 @@ class ChunkingManager(models.Manager): return res -@python_2_unicode_compatible class StudentModule(models.Model): """ Keeps student state for a particular XBlock usage and particular student. @@ -234,7 +233,6 @@ class BaseStudentModuleHistory(models.Model): return history_entries -@python_2_unicode_compatible class StudentModuleHistory(BaseStudentModuleHistory): """Keeps a complete history of state changes for a given XModule for a given Student. Right now, we restrict this to problems so that the table doesn't @@ -271,7 +269,6 @@ class StudentModuleHistory(BaseStudentModuleHistory): post_save.connect(save_history, sender=StudentModule) -@python_2_unicode_compatible class XBlockFieldBase(models.Model): """ Base class for all XBlock field storage. @@ -341,7 +338,6 @@ class XModuleStudentInfoField(XBlockFieldBase): # lint-amnesty, pylint: disable student = models.ForeignKey(User, db_index=True, on_delete=models.CASCADE) -@python_2_unicode_compatible class OfflineComputedGrade(models.Model): """ Table of grades computed offline for a given user and course. @@ -364,7 +360,6 @@ class OfflineComputedGrade(models.Model): return f"[OfflineComputedGrade] {self.user}: {self.course_id} ({self.created}) = {self.gradeset}" -@python_2_unicode_compatible class OfflineComputedGradeLog(models.Model): """ Log of when offline grades are computed. diff --git a/openedx/core/djangoapps/api_admin/models.py b/openedx/core/djangoapps/api_admin/models.py index 0594f6701d..8e5b957b23 100644 --- a/openedx/core/djangoapps/api_admin/models.py +++ b/openedx/core/djangoapps/api_admin/models.py @@ -16,7 +16,7 @@ from django.dispatch import receiver from django.urls import reverse from django.utils.translation import ugettext as _u from django.utils.translation import ugettext_lazy as _ -from django.utils.encoding import python_2_unicode_compatible + from model_utils.models import TimeStampedModel @@ -24,9 +24,6 @@ from common.djangoapps.edxmako.shortcuts import render_to_string from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers log = logging.getLogger(__name__) - - -@python_2_unicode_compatible class ApiAccessRequest(TimeStampedModel): """ Model to track API access for a user. @@ -132,7 +129,6 @@ class ApiAccessRequest(TimeStampedModel): return f'ApiAccessRequest {self.website} [{self.status}]' -@python_2_unicode_compatible class ApiAccessConfig(ConfigurationModel): """ Configuration for API management. @@ -224,7 +220,6 @@ def _send_decision_email(instance): log.exception('Error sending API user notification email for request [%s].', instance.id) -@python_2_unicode_compatible class Catalog(models.Model): """ A (non-Django-managed) model for Catalogs in the course discovery service.