diff --git a/atlas/api.py b/atlas/api.py
index 8531c1b4..0272635f 100644
--- a/atlas/api.py
+++ b/atlas/api.py
@@ -127,6 +127,9 @@ def uncategorised_dicoms(request):
def import_dicoms_helper(request, case_id: int | None = None):
+ # TODO: move this out of the api (would be better with HTMX)
+
+
# dicoms = UncategorisedDicom.objects.filter(user=request.user)
if "selection" in request.POST:
dicoms = UncategorisedDicom.objects.filter(
diff --git a/atlas/forms.py b/atlas/forms.py
index 71a68f42..96e24dc3 100755
--- a/atlas/forms.py
+++ b/atlas/forms.py
@@ -47,7 +47,7 @@ from generic.models import Examination#, Sign
# from generic.models import Examination, Site, Condition, Sign
from django.contrib.admin.widgets import FilteredSelectMultiple
-from django.forms.widgets import RadioSelect, TextInput, Textarea
+from django.forms.widgets import RadioSelect, TextInput, Textarea, Select
from tinymce.widgets import TinyMCE
@@ -63,6 +63,18 @@ from crispy_forms.helper import FormHelper
from atlas.helpers import get_cases_available_to_user
+class CaseSelect(Select):
+ template_name = "atlas/case_select_widget.html"
+
+
+ def create_option(self, *args, **kwargs):
+ option = super().create_option(*args, **kwargs)
+
+ print(option)
+
+ return option
+
+ pass
class ConditionForm(ModelForm):
class Meta:
@@ -365,7 +377,8 @@ class CaseForm(ModelForm):
url="atlas:presentation-autocomplete"
),
"subspecialty": CheckboxSelectMultiple(),
- "pathological_process": CheckboxSelectMultiple()
+ "pathological_process": CheckboxSelectMultiple(),
+ "previous_case": CaseSelect(),
}
def save(self, commit=True):
diff --git a/atlas/templates/atlas/case_select_widget.html b/atlas/templates/atlas/case_select_widget.html
new file mode 100644
index 00000000..cf40e878
--- /dev/null
+++ b/atlas/templates/atlas/case_select_widget.html
@@ -0,0 +1,19 @@
+Cases
+
+ {% for group_name, group_choices, group_index in widget.optgroups %}
+ {% for widget in group_choices %}
+ {% include widget.template_name %}
+ {{ widget.instance }}
+ {% endfor %}
+
+ {% endfor %}
+
+
Importing into case {{case}}
+Importing into case: {{case}}
{% endif %}