This commit is contained in:
Ross
2021-12-06 20:12:16 +00:00
parent 23596d8644
commit 3b4df11c96
2 changed files with 19 additions and 8 deletions
+17 -6
View File
@@ -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}),
},
)
+2 -2
View File
@@ -70,9 +70,9 @@ Use this form to create a atlas case. Existing associated image sets can be adde
{% endfor %}
</div>
{{ series_formset.management_form }}
<h3>Differenetial:</h3>
<h3>Differential:</h3>
Add differential here.
<input type="button" value="Add Differential" id="add_more_differential">
<input type="button" value="Add Another Differential" id="add_more_differential">
<div id="casedifferential_formset">
{% for form in casedifferential_formset %}
<ul class="no-error casedifferential_formset">