From fa66d6c6fa5eaa5da7c42a6f3d8077a07bd05461 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 19 Feb 2024 10:00:30 -0400 Subject: [PATCH] refactor: address PR reviews --- .../contentstore/rest_api/v2/serializers/home.py | 11 ++++++++--- cms/djangoapps/contentstore/utils.py | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/rest_api/v2/serializers/home.py b/cms/djangoapps/contentstore/rest_api/v2/serializers/home.py index 0c6a9f23cfce..857291fe838b 100644 --- a/cms/djangoapps/contentstore/rest_api/v2/serializers/home.py +++ b/cms/djangoapps/contentstore/rest_api/v2/serializers/home.py @@ -10,7 +10,8 @@ class UnsucceededCourseSerializerV2(serializers.Serializer): - """Serializer for unsucceeded course""" + """Serializer for unsucceeded course.""" + display_name = serializers.CharField() course_key = CourseKeyField() org = serializers.CharField() @@ -52,7 +53,7 @@ def get_url(self, obj): return reverse_course_url('course_handler', obj.id) def get_is_active(self, obj): - """Check if the course is active.""" + """Get whether the course is active or not.""" return not obj.has_ended() @@ -60,4 +61,8 @@ class CourseHomeTabSerializerV2(serializers.Serializer): """Serializer for course home tab V2 with unsucceeded courses and in process course actions.""" courses = CourseCommonSerializerV2(required=False, many=True) - in_process_course_actions = UnsucceededCourseSerializerV2(many=True, required=False, allow_null=True) + in_process_course_actions = UnsucceededCourseSerializerV2( + many=True, + required=False, + allow_null=True + ) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index 7b63799b9255..e542e9b9723c 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -1526,6 +1526,9 @@ def format_in_process_course_view(uca): def get_course_context_v2(request): """Get context of the homepage course tab from the Studio Home.""" + # Importing here to avoid circular imports: + # ImportError: cannot import name 'reverse_course_url' from partially initialized module + # 'cms.djangoapps.contentstore.utils' (most likely due to a circular import) from cms.djangoapps.contentstore.views.course import ( get_courses_accessible_to_user_v2, ENABLE_GLOBAL_STAFF_OPTIMIZATION,