diff --git a/atlas/forms.py b/atlas/forms.py index 61b9e03b..dc8dbfd5 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -736,13 +736,17 @@ class AnswerJSONForm(Form): options = {} ) + +class SvelteJSONEditorWidgetOverride(SvelteJSONEditorWidget): + template_name = "atlas/svelte_jsoneditor_widget_override.html" + class CaseDetailForm(ModelForm): class Meta: model = CaseDetail - fields = ["sort_order", "question_schema", "question_answers"]#, "user"] + fields = ["question_schema", "question_answers"]#, "user"] widgets = { - "question_schema": SvelteJSONEditorWidget(), - "question_answers": SvelteJSONEditorWidget(), + "question_schema": SvelteJSONEditorWidgetOverride(), + "question_answers": SvelteJSONEditorWidgetOverride(), } \ No newline at end of file diff --git a/atlas/models.py b/atlas/models.py index aeaefee8..44a3dad7 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -968,6 +968,9 @@ class CaseDetail(models.Model): class Meta: ordering = ("sort_order",) + def get_question_schema(self): + return json.dumps(self.question_schema) + class BaseReportAnswer(models.Model): question = models.ForeignKey(CaseDetail, on_delete=models.CASCADE) diff --git a/atlas/templates/atlas/collection_case_detail.html b/atlas/templates/atlas/collection_case_detail.html index 941ea1ff..320eee0d 100644 --- a/atlas/templates/atlas/collection_case_detail.html +++ b/atlas/templates/atlas/collection_case_detail.html @@ -5,7 +5,33 @@ {% block content %}
See https://django-jsonform.readthedocs.io/en/latest/guide/inputs.html for formatting
+Collection: {{case_detail.collection.name}}, Case: {{case_detail.case.title}}
+ +This form allows you to add questions to a case. A example of how the quesiton will be displayed is shown below.
+If answers are supplied the question will be automarked
+ +See https://django-jsonform.readthedocs.io/en/latest/guide/inputs.html for formatting
+ + Import schema from: + + + +