|
|
|
@ -17,6 +17,7 @@ class DispatchContentMixin(object): |
|
|
|
if ctype == 'text': |
|
|
|
if ctype == 'text': |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
t = Text.objects.get(id=cdata['id']) |
|
|
|
t = Text.objects.get(id=cdata['id']) |
|
|
|
|
|
|
|
t.uuid = cdata['uuid'] |
|
|
|
t.position = cdata['position'] |
|
|
|
t.position = cdata['position'] |
|
|
|
t.title = cdata['title'] |
|
|
|
t.title = cdata['title'] |
|
|
|
t.course = course |
|
|
|
t.course = course |
|
|
|
@ -24,6 +25,7 @@ class DispatchContentMixin(object): |
|
|
|
t.save() |
|
|
|
t.save() |
|
|
|
else: |
|
|
|
else: |
|
|
|
t = Text.objects.create( |
|
|
|
t = Text.objects.create( |
|
|
|
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
position=cdata['position'], |
|
|
|
position=cdata['position'], |
|
|
|
title=cdata['title'], |
|
|
|
title=cdata['title'], |
|
|
|
course=course, |
|
|
|
course=course, |
|
|
|
@ -32,6 +34,7 @@ class DispatchContentMixin(object): |
|
|
|
elif ctype == 'image': |
|
|
|
elif ctype == 'image': |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
image = Image.objects.get(id=cdata['id']) |
|
|
|
image = Image.objects.get(id=cdata['id']) |
|
|
|
|
|
|
|
image.uuid = cdata['uuid'] |
|
|
|
image.position = cdata['position'] |
|
|
|
image.position = cdata['position'] |
|
|
|
image.title = cdata['title'] |
|
|
|
image.title = cdata['title'] |
|
|
|
image.course = course |
|
|
|
image.course = course |
|
|
|
@ -39,6 +42,7 @@ class DispatchContentMixin(object): |
|
|
|
image.save() |
|
|
|
image.save() |
|
|
|
else: |
|
|
|
else: |
|
|
|
image = Image.objects.create( |
|
|
|
image = Image.objects.create( |
|
|
|
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
position=cdata['position'], |
|
|
|
position=cdata['position'], |
|
|
|
title=cdata['title'], |
|
|
|
title=cdata['title'], |
|
|
|
course=course, |
|
|
|
course=course, |
|
|
|
@ -47,6 +51,7 @@ class DispatchContentMixin(object): |
|
|
|
elif ctype == 'image-text': |
|
|
|
elif ctype == 'image-text': |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
it = ImageText.objects.get(id=cdata['id']) |
|
|
|
it = ImageText.objects.get(id=cdata['id']) |
|
|
|
|
|
|
|
it.uuid = cdata['uuid'] |
|
|
|
it.position = cdata['position'] |
|
|
|
it.position = cdata['position'] |
|
|
|
it.title = cdata['title'] |
|
|
|
it.title = cdata['title'] |
|
|
|
it.course = course |
|
|
|
it.course = course |
|
|
|
@ -55,6 +60,7 @@ class DispatchContentMixin(object): |
|
|
|
it.save() |
|
|
|
it.save() |
|
|
|
else: |
|
|
|
else: |
|
|
|
it = ImageText.objects.create( |
|
|
|
it = ImageText.objects.create( |
|
|
|
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
position=cdata['position'], |
|
|
|
position=cdata['position'], |
|
|
|
title=cdata['title'], |
|
|
|
title=cdata['title'], |
|
|
|
course=course, |
|
|
|
course=course, |
|
|
|
@ -64,6 +70,7 @@ class DispatchContentMixin(object): |
|
|
|
elif ctype == 'video': |
|
|
|
elif ctype == 'video': |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
v = Video.objects.get(id=cdata['id']) |
|
|
|
v = Video.objects.get(id=cdata['id']) |
|
|
|
|
|
|
|
v.uuid = cdata['uuid'] |
|
|
|
v.position = cdata['position'] |
|
|
|
v.position = cdata['position'] |
|
|
|
v.title = cdata['title'] |
|
|
|
v.title = cdata['title'] |
|
|
|
v.course = course |
|
|
|
v.course = course |
|
|
|
@ -71,6 +78,7 @@ class DispatchContentMixin(object): |
|
|
|
v.save() |
|
|
|
v.save() |
|
|
|
else: |
|
|
|
else: |
|
|
|
v = Video.objects.create( |
|
|
|
v = Video.objects.create( |
|
|
|
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
position=cdata['position'], |
|
|
|
position=cdata['position'], |
|
|
|
title=cdata['title'], |
|
|
|
title=cdata['title'], |
|
|
|
course=course, |
|
|
|
course=course, |
|
|
|
@ -79,6 +87,7 @@ class DispatchContentMixin(object): |
|
|
|
elif ctype == 'images': |
|
|
|
elif ctype == 'images': |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
if 'id' in cdata and cdata['id']: |
|
|
|
g = Gallery.objects.get(id=cdata['id']) |
|
|
|
g = Gallery.objects.get(id=cdata['id']) |
|
|
|
|
|
|
|
g.uuid = cdata['uuid'] |
|
|
|
g.course = course |
|
|
|
g.course = course |
|
|
|
g.position = cdata['position'] |
|
|
|
g.position = cdata['position'] |
|
|
|
g.title = cdata['title'] |
|
|
|
g.title = cdata['title'] |
|
|
|
@ -96,6 +105,7 @@ class DispatchContentMixin(object): |
|
|
|
) |
|
|
|
) |
|
|
|
else: |
|
|
|
else: |
|
|
|
g = Gallery.objects.create( |
|
|
|
g = Gallery.objects.create( |
|
|
|
|
|
|
|
uuid=cdata['uuid'], |
|
|
|
course=course, |
|
|
|
course=course, |
|
|
|
position=cdata['position'], |
|
|
|
position=cdata['position'], |
|
|
|
title=cdata['title'], |
|
|
|
title=cdata['title'], |
|
|
|
|