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):
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.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment