forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9bd61d
commit 65cb083
Showing
25 changed files
with
1,514 additions
and
175 deletions.
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
13 changes: 8 additions & 5 deletions
13
cms/djangoapps/contentstore/rest_api/v1/serializers/__init__.py
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 |
---|---|---|
@@ -1,24 +1,27 @@ | ||
""" | ||
Serializers for v1 contentstore API. | ||
""" | ||
from .certificates import CourseCertificatesSerializer | ||
from .course_details import CourseDetailsSerializer | ||
from .course_index import CourseIndexSerializer | ||
from .course_rerun import CourseRerunSerializer | ||
from .course_team import CourseTeamSerializer | ||
from .course_index import CourseIndexSerializer | ||
from .grading import CourseGradingModelSerializer, CourseGradingSerializer | ||
from .group_configurations import CourseGroupConfigurationsSerializer | ||
from .home import CourseHomeSerializer, CourseHomeTabSerializer, LibraryTabSerializer | ||
from .proctoring import ( | ||
LimitedProctoredExamSettingsSerializer, | ||
ProctoredExamConfigurationSerializer, | ||
ProctoredExamSettingsSerializer, | ||
ProctoringErrorsSerializer | ||
ProctoringErrorsSerializer, | ||
) | ||
from .settings import CourseSettingsSerializer | ||
from .textbooks import CourseTextbooksSerializer | ||
from .vertical_block import ContainerHandlerSerializer, VerticalContainerSerializer | ||
from .videos import ( | ||
CourseVideosSerializer, | ||
VideoUploadSerializer, | ||
VideoDownloadSerializer, | ||
VideoImageSerializer, | ||
VideoUploadSerializer, | ||
VideoUsageSerializer, | ||
VideoDownloadSerializer | ||
) | ||
from .vertical_block import ContainerHandlerSerializer |
52 changes: 52 additions & 0 deletions
52
cms/djangoapps/contentstore/rest_api/v1/serializers/certificates.py
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,52 @@ | ||
""" | ||
API Serializers for certificates page | ||
""" | ||
|
||
from rest_framework import serializers | ||
|
||
|
||
class CertificateSignatorySerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing certificate's signatory. | ||
""" | ||
|
||
id = serializers.IntegerField() | ||
name = serializers.CharField() | ||
organization = serializers.CharField(required=False) | ||
signature_image_path = serializers.CharField() | ||
title = serializers.CharField() | ||
|
||
|
||
class CertificateItemSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing certificate item created for current course. | ||
""" | ||
|
||
course_title = serializers.CharField(required=False) | ||
description = serializers.CharField() | ||
editing = serializers.BooleanField(required=False) | ||
id = serializers.IntegerField() | ||
is_active = serializers.BooleanField() | ||
name = serializers.CharField() | ||
signatories = CertificateSignatorySerializer(many=True) | ||
version = serializers.IntegerField() | ||
|
||
|
||
class CourseCertificatesSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing course's certificates. | ||
""" | ||
|
||
certificate_activation_handler_url = serializers.CharField() | ||
certificate_web_view_url = serializers.CharField(allow_null=True) | ||
certificates = CertificateItemSerializer(many=True, allow_null=True) | ||
course_modes = serializers.ListField(child=serializers.CharField()) | ||
has_certificate_modes = serializers.BooleanField() | ||
is_active = serializers.BooleanField() | ||
is_global_staff = serializers.BooleanField() | ||
mfe_proctored_exam_settings_url = serializers.CharField( | ||
required=False, allow_null=True, allow_blank=True | ||
) | ||
course_number = serializers.CharField(source="context_course.number") | ||
course_title = serializers.CharField(source="context_course.display_name_with_default") | ||
course_number_override = serializers.CharField(source="context_course.display_coursenumber") |
59 changes: 59 additions & 0 deletions
59
cms/djangoapps/contentstore/rest_api/v1/serializers/group_configurations.py
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,59 @@ | ||
""" | ||
API Serializers for course's settings group configurations. | ||
""" | ||
|
||
from rest_framework import serializers | ||
|
||
|
||
class GroupConfigurationUsageSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing nested usage inside configuration. | ||
""" | ||
|
||
label = serializers.CharField() | ||
url = serializers.CharField() | ||
validation = serializers.DictField(required=False) | ||
|
||
|
||
class GroupConfigurationGroupSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing nested group inside configuration. | ||
""" | ||
|
||
id = serializers.IntegerField() | ||
name = serializers.CharField() | ||
usage = GroupConfigurationUsageSerializer(required=False, allow_null=True, many=True) | ||
version = serializers.IntegerField() | ||
|
||
|
||
class GroupConfigurationItemSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing group configurations item. | ||
""" | ||
|
||
active = serializers.BooleanField() | ||
description = serializers.CharField() | ||
groups = GroupConfigurationGroupSerializer(allow_null=True, many=True) | ||
id = serializers.IntegerField() | ||
usage = GroupConfigurationUsageSerializer(required=False, allow_null=True, many=True) | ||
name = serializers.CharField() | ||
parameters = serializers.DictField() | ||
read_only = serializers.BooleanField(required=False) | ||
scheme = serializers.CharField() | ||
version = serializers.IntegerField() | ||
|
||
|
||
class CourseGroupConfigurationsSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing course's settings group configurations. | ||
""" | ||
|
||
all_group_configurations = GroupConfigurationItemSerializer(many=True) | ||
experiment_group_configurations = GroupConfigurationItemSerializer( | ||
allow_null=True, many=True | ||
) | ||
mfe_proctored_exam_settings_url = serializers.CharField( | ||
required=False, allow_null=True, allow_blank=True | ||
) | ||
should_show_enrollment_track = serializers.BooleanField() | ||
should_show_experiment_groups = serializers.BooleanField() |
32 changes: 32 additions & 0 deletions
32
cms/djangoapps/contentstore/rest_api/v1/serializers/textbooks.py
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,32 @@ | ||
""" | ||
API Serializers for textbooks page | ||
""" | ||
|
||
from rest_framework import serializers | ||
|
||
|
||
class CourseTextbookChapterSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing textbook chapter. | ||
""" | ||
|
||
title = serializers.CharField() | ||
url = serializers.CharField() | ||
|
||
|
||
class CourseTextbookItemSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing textbook item. | ||
""" | ||
|
||
id = serializers.CharField() | ||
chapters = CourseTextbookChapterSerializer(many=True) | ||
tab_title = serializers.CharField() | ||
|
||
|
||
class CourseTextbooksSerializer(serializers.Serializer): | ||
""" | ||
Serializer for representing course's textbooks. | ||
""" | ||
|
||
textbooks = serializers.ListField() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
""" | ||
Views for v1 contentstore API. | ||
""" | ||
from .certificates import CourseCertificatesView | ||
from .course_details import CourseDetailsView | ||
from .course_index import CourseIndexView | ||
from .course_team import CourseTeamView | ||
from .course_rerun import CourseRerunView | ||
from .course_team import CourseTeamView | ||
from .grading import CourseGradingView | ||
from .group_configurations import CourseGroupConfigurationsView | ||
from .help_urls import HelpUrlsView | ||
from .home import HomePageCoursesView, HomePageLibrariesView, HomePageView | ||
from .proctoring import ProctoredExamSettingsView, ProctoringErrorsView | ||
from .home import HomePageView, HomePageCoursesView, HomePageLibrariesView | ||
from .settings import CourseSettingsView | ||
from .videos import ( | ||
CourseVideosView, | ||
VideoUsageView, | ||
VideoDownloadView | ||
) | ||
from .help_urls import HelpUrlsView | ||
from .vertical_block import ContainerHandlerView | ||
from .textbooks import CourseTextbooksView | ||
from .vertical_block import ContainerHandlerView, VerticalContainerView | ||
from .videos import CourseVideosView, VideoDownloadView, VideoUsageView |
Oops, something went wrong.