|
|
|
|
@ -12,6 +12,7 @@ from apps.content.models import ( |
|
|
|
|
Gallery, GalleryImage, ImageObject, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
from .user import UserSerializer |
|
|
|
|
from .mixins import DispatchContentMixin, DispatchGalleryMixin, DispatchMaterialMixin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -124,7 +125,6 @@ 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 |
|
|
|
|
course = super().create(validated_data) |
|
|
|
|
@ -151,6 +151,7 @@ class CourseCreateSerializer(DispatchContentMixin, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CourseSerializer(CourseCreateSerializer): |
|
|
|
|
author = UserSerializer() |
|
|
|
|
category = CategorySerializer() |
|
|
|
|
materials = MaterialSerializer(many=True) |
|
|
|
|
cover = ImageObjectSerializer() |
|
|
|
|
|