Fix auto assign author

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent b86435ff71
commit d6a7533b45
  1. 2
      api/v1/serializers/course.py

@ -142,7 +142,7 @@ class CourseCreateSerializer(DispatchContentMixin,
materials = validated_data.pop('materials', []) materials = validated_data.pop('materials', [])
gallery = validated_data.pop('gallery', {}) gallery = validated_data.pop('gallery', {})
author = validated_data.get('author', None) author = validated_data.get('author', None)
if not instance.author or not author: if not instance.author or author and instance.author != author:
validated_data['author'] = self.context['request'].user validated_data['author'] = self.context['request'].user
course = super().update(instance, validated_data) course = super().update(instance, validated_data)
self.dispatch_materials(course, materials) self.dispatch_materials(course, materials)

Loading…
Cancel
Save