From 7cfbc24e8b4d314b1c31850b067c16d0a01a3012 Mon Sep 17 00:00:00 2001 From: "anas.hameed" Date: Tue, 27 Aug 2024 18:08:22 +0500 Subject: [PATCH] Fix: Add language in the course listing API for syncing with dataloader --- lms/djangoapps/course_api/serializers.py | 1 + lms/djangoapps/course_api/views.py | 3 ++- openedx/core/djangoapps/content/course_overviews/models.py | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/course_api/serializers.py b/lms/djangoapps/course_api/serializers.py index d2e28184ae51..7aa924bde4ef 100644 --- a/lms/djangoapps/course_api/serializers.py +++ b/lms/djangoapps/course_api/serializers.py @@ -77,6 +77,7 @@ class CourseSerializer(serializers.Serializer): # pylint: disable=abstract-meth mobile_available = serializers.BooleanField() hidden = serializers.SerializerMethodField() invitation_only = serializers.BooleanField() + language = serializers.CharField() # 'course_id' is a deprecated field, please use 'id' instead. course_id = serializers.CharField(source='id', read_only=True) diff --git a/lms/djangoapps/course_api/views.py b/lms/djangoapps/course_api/views.py index 94eb84508aed..15b161559606 100644 --- a/lms/djangoapps/course_api/views.py +++ b/lms/djangoapps/course_api/views.py @@ -303,7 +303,8 @@ class CourseListView(DeveloperErrorViewMixin, ListAPIView): "org": "edX", "start": "2015-07-17T12:00:00Z", "start_display": "July 17, 2015", - "start_type": "timestamp" + "start_type": "timestamp", + language: null or 'en' # language code } ] """ diff --git a/openedx/core/djangoapps/content/course_overviews/models.py b/openedx/core/djangoapps/content/course_overviews/models.py index 5c0f4323b4de..512c9da7355b 100644 --- a/openedx/core/djangoapps/content/course_overviews/models.py +++ b/openedx/core/djangoapps/content/course_overviews/models.py @@ -226,8 +226,7 @@ def _create_or_update(cls, course): course_overview.course_video_url = CourseDetails.fetch_video_url(course.id) course_overview.self_paced = course.self_paced - if not CatalogIntegration.is_enabled(): - course_overview.language = course.language + course_overview.language = course.language return course_overview