|
|
|
|
@ -17,7 +17,6 @@ class DispatchContentMixin(object): |
|
|
|
|
if ctype == 'text': |
|
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
|
t = Text.objects.get(id=cdata['id']) |
|
|
|
|
t.uuid = cdata['uuid'] |
|
|
|
|
t.position = cdata['position'] |
|
|
|
|
t.title = cdata['title'] |
|
|
|
|
t.course = course |
|
|
|
|
@ -26,7 +25,6 @@ class DispatchContentMixin(object): |
|
|
|
|
t.save() |
|
|
|
|
else: |
|
|
|
|
t = Text.objects.create( |
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
|
position=cdata['position'], |
|
|
|
|
title=cdata['title'], |
|
|
|
|
course=course, |
|
|
|
|
@ -48,11 +46,9 @@ class DispatchContentMixin(object): |
|
|
|
|
except ImageObject.DoesNotExist: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
image.uuid = cdata['uuid'] |
|
|
|
|
image.save() |
|
|
|
|
else: |
|
|
|
|
image = Image.objects.create( |
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
|
position=cdata['position'], |
|
|
|
|
title=cdata['title'], |
|
|
|
|
course=course, |
|
|
|
|
@ -81,11 +77,9 @@ class DispatchContentMixin(object): |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
it.txt = cdata['txt'] |
|
|
|
|
it.uuid = cdata['uuid'] |
|
|
|
|
it.save() |
|
|
|
|
else: |
|
|
|
|
it = ImageText.objects.create( |
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
|
position=cdata['position'], |
|
|
|
|
title=cdata['title'], |
|
|
|
|
course=course, |
|
|
|
|
@ -101,7 +95,6 @@ class DispatchContentMixin(object): |
|
|
|
|
elif ctype == 'video': |
|
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
|
v = Video.objects.get(id=cdata['id']) |
|
|
|
|
v.uuid = cdata['uuid'] |
|
|
|
|
v.position = cdata['position'] |
|
|
|
|
v.title = cdata['title'] |
|
|
|
|
v.course = course |
|
|
|
|
@ -110,7 +103,6 @@ class DispatchContentMixin(object): |
|
|
|
|
v.save() |
|
|
|
|
else: |
|
|
|
|
v = Video.objects.create( |
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
|
position=cdata['position'], |
|
|
|
|
title=cdata['title'], |
|
|
|
|
course=course, |
|
|
|
|
@ -120,7 +112,6 @@ class DispatchContentMixin(object): |
|
|
|
|
elif ctype == 'images': |
|
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
|
g = Gallery.objects.get(id=cdata['id']) |
|
|
|
|
g.uuid = cdata['uuid'] |
|
|
|
|
g.course = course |
|
|
|
|
g.position = cdata['position'] |
|
|
|
|
g.title = cdata['title'] |
|
|
|
|
@ -139,7 +130,6 @@ class DispatchContentMixin(object): |
|
|
|
|
) |
|
|
|
|
else: |
|
|
|
|
g = Gallery.objects.create( |
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
|
course=course, |
|
|
|
|
position=cdata['position'], |
|
|
|
|
title=cdata['title'], |
|
|
|
|
|