Full author data in Course serializer

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent c8003b1844
commit 768ff97368
  1. 3
      api/v1/serializers/course.py

@ -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()

Loading…
Cancel
Save