From c88e1773ab65f65605aa0fc83472e54926188105 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Tue, 13 Feb 2018 19:51:01 +0300 Subject: [PATCH] Fix auto assign author --- api/v1/serializers/course.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/v1/serializers/course.py b/api/v1/serializers/course.py index 27810603..ed30182b 100644 --- a/api/v1/serializers/course.py +++ b/api/v1/serializers/course.py @@ -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)