.
This commit is contained in:
+17
-6
@@ -9,7 +9,16 @@ from django.forms import (
|
|||||||
)
|
)
|
||||||
from django.forms import inlineformset_factory
|
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
|
from anatomy.models import Modality
|
||||||
|
|
||||||
@@ -24,6 +33,7 @@ from tinymce.widgets import TinyMCE
|
|||||||
|
|
||||||
from dal import autocomplete
|
from dal import autocomplete
|
||||||
|
|
||||||
|
|
||||||
class ConditionForm(ModelForm):
|
class ConditionForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Condition
|
model = Condition
|
||||||
@@ -38,6 +48,7 @@ class ConditionForm(ModelForm):
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FindingForm(ModelForm):
|
class FindingForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Finding
|
model = Finding
|
||||||
@@ -49,6 +60,7 @@ class FindingForm(ModelForm):
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class StructureForm(ModelForm):
|
class StructureForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Structure
|
model = Structure
|
||||||
@@ -60,6 +72,7 @@ class StructureForm(ModelForm):
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class SeriesFindingForm(ModelForm):
|
class SeriesFindingForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SeriesFinding
|
model = SeriesFinding
|
||||||
@@ -82,7 +95,7 @@ class SeriesFindingForm(ModelForm):
|
|||||||
# The widget for a ModelMultipleChoiceField expects
|
# The widget for a ModelMultipleChoiceField expects
|
||||||
# a list of primary key for the selected data.
|
# a list of primary key for the selected data.
|
||||||
initial["series"] = kwargs.pop("series_id")
|
initial["series"] = kwargs.pop("series_id")
|
||||||
#elif kwargs.get("instance"):
|
# elif kwargs.get("instance"):
|
||||||
# # We get the 'initial' keyword argument or initialize it
|
# # We get the 'initial' keyword argument or initialize it
|
||||||
# # as a dict if it didn't exist.
|
# # as a dict if it didn't exist.
|
||||||
# initial = kwargs.setdefault("initial", {})
|
# initial = kwargs.setdefault("initial", {})
|
||||||
@@ -165,11 +178,11 @@ class SeriesForm(ModelForm):
|
|||||||
model = Series
|
model = Series
|
||||||
exclude = ["author"]
|
exclude = ["author"]
|
||||||
|
|
||||||
|
|
||||||
widgets = {
|
widgets = {
|
||||||
"examination": autocomplete.ModelSelect2(
|
"examination": autocomplete.ModelSelect2(
|
||||||
url="generic:examination-autocomplete"
|
url="generic:examination-autocomplete"
|
||||||
),
|
),
|
||||||
|
"description": Textarea(attrs={"maxlength": 1000, "rows": 5, "cols": 80}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -267,9 +280,7 @@ CaseDifferentialFormSet = inlineformset_factory(
|
|||||||
max_num=10,
|
max_num=10,
|
||||||
widgets={
|
widgets={
|
||||||
"condition": autocomplete.ModelSelect2(url="atlas:condition-autocomplete"),
|
"condition": autocomplete.ModelSelect2(url="atlas:condition-autocomplete"),
|
||||||
"text": Textarea(
|
"text": Textarea(attrs={"maxlength": 1000, "rows": 3, "cols": 80}),
|
||||||
attrs={"maxlength": 1000, "rows": 3, "cols": 80}
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ Use this form to create a atlas case. Existing associated image sets can be adde
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{{ series_formset.management_form }}
|
{{ series_formset.management_form }}
|
||||||
<h3>Differenetial:</h3>
|
<h3>Differential:</h3>
|
||||||
Add differential here.
|
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">
|
<div id="casedifferential_formset">
|
||||||
{% for form in casedifferential_formset %}
|
{% for form in casedifferential_formset %}
|
||||||
<ul class="no-error casedifferential_formset">
|
<ul class="no-error casedifferential_formset">
|
||||||
|
|||||||
Reference in New Issue
Block a user