|
|
|
|
@ -123,6 +123,9 @@ class CourseCreateSerializer(DispatchContentMixin, |
|
|
|
|
content = validated_data.pop('content', []) |
|
|
|
|
materials = validated_data.pop('materials', []) |
|
|
|
|
gallery = validated_data.pop('gallery', {}) |
|
|
|
|
author = validated_data.get('author', None) |
|
|
|
|
if not author: |
|
|
|
|
validated_data['author'] = self.context.request.user |
|
|
|
|
course = super().create(validated_data) |
|
|
|
|
self.dispatch_content(course, content) |
|
|
|
|
self.dispatch_materials(course, materials) |
|
|
|
|
@ -133,6 +136,8 @@ class CourseCreateSerializer(DispatchContentMixin, |
|
|
|
|
content = validated_data.pop('content', []) |
|
|
|
|
materials = validated_data.pop('materials', []) |
|
|
|
|
gallery = validated_data.pop('gallery', {}) |
|
|
|
|
if not author: |
|
|
|
|
validated_data['author'] = self.context.request.user |
|
|
|
|
course = super().update(instance, validated_data) |
|
|
|
|
self.dispatch_materials(course, materials) |
|
|
|
|
self.dispatch_content(course, content) |
|
|
|
|
|