From 8571eeca613346716a5ca7a2447b11948f9c4e00 Mon Sep 17 00:00:00 2001 From: Nathan Sprenkle Date: Wed, 20 Mar 2024 11:02:41 -0400 Subject: [PATCH] feat: add course language to courseware API (#34392) --- openedx/core/djangoapps/courseware_api/serializers.py | 1 + openedx/core/djangoapps/courseware_api/views.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/openedx/core/djangoapps/courseware_api/serializers.py b/openedx/core/djangoapps/courseware_api/serializers.py index 62235a6aef..47b977532f 100644 --- a/openedx/core/djangoapps/courseware_api/serializers.py +++ b/openedx/core/djangoapps/courseware_api/serializers.py @@ -91,6 +91,7 @@ class CourseInfoSerializer(serializers.Serializer): # pylint: disable=abstract- entrance_exam_data = serializers.DictField() id = serializers.CharField() # pylint: disable=invalid-name license = serializers.CharField() + language = serializers.CharField(allow_null=True) media = _CourseApiMediaCollectionSerializer(source='*') name = serializers.CharField(source='display_name_with_default_escaped') offer = serializers.DictField() diff --git a/openedx/core/djangoapps/courseware_api/views.py b/openedx/core/djangoapps/courseware_api/views.py index 9548f121fd..7f56133b34 100644 --- a/openedx/core/djangoapps/courseware_api/views.py +++ b/openedx/core/djangoapps/courseware_api/views.py @@ -134,6 +134,10 @@ class CoursewareMeta: def license(self): return self.course.license + @property + def language(self): + return self.course.language + @property def notes(self): """ @@ -418,6 +422,7 @@ class CoursewareInformation(RetrieveAPIView): * entrance_exam_passed: (bool) Indicates if the entrance exam has been passed * id: A unique identifier of the course; a serialized representation of the opaque key identifying the course. + * language: The language code for the course * media: An object that contains named media items. Included here: * course_image: An image to show for the course. Represented as an object with the following fields: