Commit 3385ce31 by Braden MacDonald

Fix auto generated ID fields in old mongo

parent adf8de62
...@@ -223,7 +223,7 @@ class AnswerBlock(AnswerMixin, StepMixin, StudioEditableXBlockMixin, XBlock): ...@@ -223,7 +223,7 @@ class AnswerBlock(AnswerMixin, StepMixin, StudioEditableXBlockMixin, XBlock):
""" """
# Generate a random 'name' value # Generate a random 'name' value
if template_id == 'studio_default': if template_id == 'studio_default':
return {'metadata': {'name': uuid.uuid4().hex[:7]}, 'data': {}} return {'data': {'name': uuid.uuid4().hex[:7]}}
return {'metadata': {}, 'data': {}} return {'metadata': {}, 'data': {}}
......
...@@ -107,7 +107,7 @@ class ChoiceBlock(StudioEditableXBlockMixin, XBlock): ...@@ -107,7 +107,7 @@ class ChoiceBlock(StudioEditableXBlockMixin, XBlock):
# Generate a random 'value' value. We can't just use default=UNIQUE_ID on the field, # Generate a random 'value' value. We can't just use default=UNIQUE_ID on the field,
# because that doesn't work properly with import/export, re-run, or duplicating the block # because that doesn't work properly with import/export, re-run, or duplicating the block
if template_id == 'studio_default': if template_id == 'studio_default':
return {'metadata': {'value': uuid.uuid4().hex[:7]}, 'data': {}} return {'data': {'value': uuid.uuid4().hex[:7]}}
return {'metadata': {}, 'data': {}} return {'metadata': {}, 'data': {}}
@classmethod @classmethod
......
...@@ -85,7 +85,7 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin): ...@@ -85,7 +85,7 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin):
""" """
Used to interact with Studio's create_xblock method to instantiate pre-defined templates. Used to interact with Studio's create_xblock method to instantiate pre-defined templates.
""" """
return {'metadata': {'type': template_id, 'content': "Message goes here."}, 'data': {}} return {'data': {'type': template_id, 'content': "Message goes here."}}
@classmethod @classmethod
def parse_xml(cls, node, runtime, keys, id_generator): def parse_xml(cls, node, runtime, keys, id_generator):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment