From 3b4df11c9627f4ac4f7fa49c7d1602bb603cda8d Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 6 Dec 2021 20:12:16 +0000 Subject: [PATCH] . --- atlas/forms.py | 23 +++++++++++++++++------ atlas/templates/atlas/case_form.html | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/atlas/forms.py b/atlas/forms.py index d73abca0..5515368c 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -9,7 +9,16 @@ from django.forms import ( ) from django.forms import inlineformset_factory -from atlas.models import Case, Differential, Finding, Series, SeriesImage, SeriesFinding, Condition, Structure +from atlas.models import ( + Case, + Differential, + Finding, + Series, + SeriesImage, + SeriesFinding, + Condition, + Structure, +) from anatomy.models import Modality @@ -24,6 +33,7 @@ from tinymce.widgets import TinyMCE from dal import autocomplete + class ConditionForm(ModelForm): class Meta: model = Condition @@ -38,6 +48,7 @@ class ConditionForm(ModelForm): ), } + class FindingForm(ModelForm): class Meta: model = Finding @@ -49,6 +60,7 @@ class FindingForm(ModelForm): ), } + class StructureForm(ModelForm): class Meta: model = Structure @@ -60,6 +72,7 @@ class StructureForm(ModelForm): ), } + class SeriesFindingForm(ModelForm): class Meta: model = SeriesFinding @@ -82,7 +95,7 @@ class SeriesFindingForm(ModelForm): # The widget for a ModelMultipleChoiceField expects # a list of primary key for the selected data. initial["series"] = kwargs.pop("series_id") - #elif kwargs.get("instance"): + # elif kwargs.get("instance"): # # We get the 'initial' keyword argument or initialize it # # as a dict if it didn't exist. # initial = kwargs.setdefault("initial", {}) @@ -165,11 +178,11 @@ class SeriesForm(ModelForm): model = Series exclude = ["author"] - widgets = { "examination": autocomplete.ModelSelect2( url="generic:examination-autocomplete" ), + "description": Textarea(attrs={"maxlength": 1000, "rows": 5, "cols": 80}), } @@ -267,9 +280,7 @@ CaseDifferentialFormSet = inlineformset_factory( max_num=10, widgets={ "condition": autocomplete.ModelSelect2(url="atlas:condition-autocomplete"), - "text": Textarea( - attrs={"maxlength": 1000, "rows": 3, "cols": 80} - ) + "text": Textarea(attrs={"maxlength": 1000, "rows": 3, "cols": 80}), }, ) diff --git a/atlas/templates/atlas/case_form.html b/atlas/templates/atlas/case_form.html index 713fc2cf..bf5febcd 100755 --- a/atlas/templates/atlas/case_form.html +++ b/atlas/templates/atlas/case_form.html @@ -70,9 +70,9 @@ Use this form to create a atlas case. Existing associated image sets can be adde {% endfor %} {{ series_formset.management_form }} -

Differenetial:

+

Differential:

Add differential here. - +
{% for form in casedifferential_formset %}