numerous uploading fixes
This commit is contained in:
+28
-3
@@ -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"]
|
||||
Reference in New Issue
Block a user