Skip to content
Snippets Groups Projects
Commit c8b3fcff authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-163: only set jsoneditorwidget for Subtask instances, not for lists, to prevent exceptions

parent b5141819
No related branches found
No related tags found
2 merge requests!110Resolve TMSS-163,!104Resolve TMSS-146
...@@ -157,10 +157,11 @@ class SubtaskSerializerJSONeditorOnline(RelationalHyperlinkedModelSerializer): ...@@ -157,10 +157,11 @@ class SubtaskSerializerJSONeditorOnline(RelationalHyperlinkedModelSerializer):
import json import json
try: try:
schema = self.instance.specifications_template.schema if isinstance(self.instance, models.Subtask):
self.fields['specifications_doc'] = serializers.JSONField( schema = self.instance.specifications_template.schema
style={'template': 'josdejong_jsoneditor_widget.html', self.fields['specifications_doc'] = serializers.JSONField(
'schema': json.dumps(schema)}) style={'template': 'josdejong_jsoneditor_widget.html',
'schema': json.dumps(schema)})
except Exception as e: except Exception as e:
# todo: Shall we use one of the default templates for the init? # todo: Shall we use one of the default templates for the init?
logger.exception('Could not determine schema, hence no fancy JSON form. Expected for list view.') logger.exception('Could not determine schema, hence no fancy JSON form. Expected for list view.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment