|
|
|
|
@ -221,13 +221,11 @@ class CourseCreateSerializer(serializers.ModelSerializer): |
|
|
|
|
if 'id' in gallery and gallery['id']: |
|
|
|
|
g = Gallery.objects.get(id=gallery['id']) |
|
|
|
|
g.title = gallery.get('title', g.title) |
|
|
|
|
# g.course = course |
|
|
|
|
g.position = 0 |
|
|
|
|
g.save() |
|
|
|
|
else: |
|
|
|
|
g = Gallery.objects.create( |
|
|
|
|
title=gallery.get('title', ''), |
|
|
|
|
# course=course, |
|
|
|
|
position=0, |
|
|
|
|
) |
|
|
|
|
if 'images' in gallery: |
|
|
|
|
@ -366,6 +364,7 @@ class LessonCreateSerializer(serializers.ModelSerializer): |
|
|
|
|
g = Gallery.objects.get(id=c['data']['id']) |
|
|
|
|
g.position = c['data']['position'] |
|
|
|
|
g.title = c['data']['title'] |
|
|
|
|
g.lesson = lesson |
|
|
|
|
g.save() |
|
|
|
|
if 'images' in c['data']: |
|
|
|
|
for image in c['data']['images']: |
|
|
|
|
@ -375,6 +374,7 @@ class LessonCreateSerializer(serializers.ModelSerializer): |
|
|
|
|
) |
|
|
|
|
else: |
|
|
|
|
g = Gallery.objects.create( |
|
|
|
|
lesson=lesson, |
|
|
|
|
position=c['data']['position'], |
|
|
|
|
title=c['data']['title'], |
|
|
|
|
) |
|
|
|
|
|