Commit c8b3fcff authored by Jorrit Schaap's avatar Jorrit Schaap

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

parent b5141819
......@@ -157,10 +157,11 @@ class SubtaskSerializerJSONeditorOnline(RelationalHyperlinkedModelSerializer):
import json
try:
schema = self.instance.specifications_template.schema
self.fields['specifications_doc'] = serializers.JSONField(
style={'template': 'josdejong_jsoneditor_widget.html',
'schema': json.dumps(schema)})
if isinstance(self.instance, models.Subtask):
schema = self.instance.specifications_template.schema
self.fields['specifications_doc'] = serializers.JSONField(
style={'template': 'josdejong_jsoneditor_widget.html',
'schema': json.dumps(schema)})
except Exception as e:
# 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.')
......
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