-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33296 from raccoongang/rg/feat/FC0031/extended_bl…
…ocks_in_course_view feat: [FC-0031] Add new endpoint BlocksInfoInCourseView
- Loading branch information
Showing
4 changed files
with
233 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Course Info serializers | ||
""" | ||
from rest_framework import serializers | ||
|
||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview | ||
|
||
|
||
class CourseInfoOverviewSerializer(serializers.ModelSerializer): | ||
""" | ||
Serializer for serialize additional fields in BlocksInfoInCourseView. | ||
""" | ||
|
||
name = serializers.CharField(source='display_name') | ||
number = serializers.CharField(source='display_number_with_default') | ||
org = serializers.CharField(source='display_org_with_default') | ||
is_self_paced = serializers.BooleanField(source='self_paced') | ||
media = serializers.SerializerMethodField() | ||
|
||
class Meta: | ||
model = CourseOverview | ||
fields = ( | ||
'name', | ||
'number', | ||
'org', | ||
'start', | ||
'start_display', | ||
'start_type', | ||
'end', | ||
'is_self_paced', | ||
'media', | ||
) | ||
|
||
@staticmethod | ||
def get_media(obj): | ||
return {'image': obj.image_urls} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters