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