Skip to content

Commit

Permalink
fix: made other course settings optional in serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanDavidBuitrago committed Oct 8, 2024
1 parent 2fc55c1 commit d0b9885
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lms/djangoapps/ccx/api/v0/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CCXCourseSerializer(serializers.ModelSerializer):
due = serializers.CharField(allow_blank=True)
max_students_allowed = serializers.IntegerField(source='max_student_enrollments_allowed')
course_modules = serializers.SerializerMethodField()
other_course_settings = serializers.JSONField()
other_course_settings = serializers.JSONField(required=False)

class Meta:
model = CustomCourseForEdX
Expand Down
7 changes: 2 additions & 5 deletions lms/djangoapps/ccx/api/v0/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,8 @@ def get_valid_input(request_data, ignore_missing=False):
field_errors['max_students_allowed'] = {'error_code': 'null_field_max_students_allowed'}

other_course_settings = request_data.get('other_course_settings')
if other_course_settings is not None:
if isinstance(other_course_settings, dict):
valid_input['other_course_settings'] = other_course_settings
else:
field_errors['other_course_settings'] = {'error_code': 'invalid_other_course_settings_type'}
if other_course_settings and isinstance(other_course_settings, dict):
valid_input['other_course_settings'] = other_course_settings

course_modules = request_data.get('course_modules')
if course_modules is not None:
Expand Down

0 comments on commit d0b9885

Please sign in to comment.