Commit f8c086d9 by Xavier Antoviaque

Only attempt to locate a model object when an answer has a name

parent c874d961
...@@ -86,10 +86,13 @@ class AnswerBlock(XBlock): ...@@ -86,10 +86,13 @@ class AnswerBlock(XBlock):
Replicate data changes on the related Django model used for sharing of data accross XBlocks Replicate data changes on the related Django model used for sharing of data accross XBlocks
""" """
super(AnswerBlock, self).save() super(AnswerBlock, self).save()
answer_data = self.get_model_object()
if answer_data.student_input != self.student_input and not self.read_only: # Only attempt to locate a model object for this block when the answer has a name
answer_data.student_input = self.student_input if self.name:
answer_data.save() answer_data = self.get_model_object()
if answer_data.student_input != self.student_input and not self.read_only:
answer_data.student_input = self.student_input
answer_data.save()
def get_model_object(self, name=None): def get_model_object(self, name=None):
""" """
......
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