numerous uploading fixes

This commit is contained in:
Ross
2024-05-13 09:48:43 +01:00
parent 490d1956af
commit 21d83052cf
13 changed files with 143 additions and 9 deletions
+28 -3
View File
@@ -16,6 +16,8 @@ from django.forms import (
)
from django.forms import inlineformset_factory
from django.shortcuts import get_object_or_404
from django_jsonforms.forms import JSONSchemaField
from atlas.models import (
Case,
@@ -516,8 +518,13 @@ SeriesImageFormSet = inlineformset_factory(
)
class BaseReportAnswerForm(ModelForm):
json_answer = JSONSchemaField(
schema = "schema/report.json",
#options = 'schema/options.json'
options = {}
)
class Meta:
fields = ["answer"]
fields = ["answer", "json_answer"]
widgets = {
# "normal": RadioSelect(
@@ -532,9 +539,13 @@ class BaseReportAnswerForm(ModelForm):
# "answer": "Write your answer in here."
# }
def __init__(self, *args, **kwargs):
def __init__(self, *args, case_detail, **kwargs):
super(BaseReportAnswerForm, self).__init__(*args, **kwargs)
self.fields["answer"].required = False
#self.fields["json_answer"].schema = case_detail.question_schema
if case_detail.question_schema is not None:
self.fields["json_answer"] = JSONSchemaField(schema=case_detail.question_schema, options={})
class CidReportAnswerForm(BaseReportAnswerForm):
class Meta(BaseReportAnswerForm.Meta):
@@ -698,4 +709,18 @@ class CaseAuthorForm(ExamAuthorFormMixin):
model = Case
class SeriesAuthorForm(ExamAuthorFormMixin):
class Meta(ExamAuthorFormMixin.Meta):
model = Series
model = Series
class AnswerJSONForm(Form):
json = JSONSchemaField(
schema = 'schema/schema.json',
#options = 'schema/options.json'
options = {}
)
class CaseDetailForm(ModelForm):
class Meta:
model = CaseDetail
fields = ["sort_order", "question_schema"]#, "user"]