diff --git a/atlas/forms.py b/atlas/forms.py index c97b5130..3aac298d 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -533,6 +533,13 @@ class CaseSeriesForm(ModelForm): else: queryset = Series.objects.all() + # Optimize the queryset for the ModelChoiceField + queryset = queryset.select_related( + "modality" + ).prefetch_related( + "examination", "plane", "contrast", "images" + ) + self.fields["series"] = ModelChoiceField( required=False, queryset=queryset, @@ -541,7 +548,6 @@ class CaseSeriesForm(ModelForm): - class CaseCollectionCaseForm(ModelForm): def __init__(self, *args, user, collection=None, **kwargs): super(CaseCollectionCaseForm, self).__init__(*args, **kwargs) diff --git a/atlas/templates/atlas/case_form.html b/atlas/templates/atlas/case_form.html index 0207334d..b302095a 100755 --- a/atlas/templates/atlas/case_form.html +++ b/atlas/templates/atlas/case_form.html @@ -143,51 +143,87 @@ {% comment %} {{ form }} {% endcomment %} -
Add image sets here. These can only be added once created (they can also be added to cases on creation).
+