add option to reorder all series in a case at once
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
Atlas:
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href="{% url 'atlas:collection_view' %}">Collections</a> /
|
||||
<a href="{% url 'atlas:case_view' %}"?sort=-created_date>Cases</a> /
|
||||
<a href="{% url 'atlas:case_view' %}?sort=-created_date">Cases</a> /
|
||||
<a href="{% url 'atlas:series_view' %}">Series</a> /
|
||||
<a href="{% url 'atlas:categories_list' %}">Categories</a> /
|
||||
<a href="{% url 'atlas:case_create' %}" title="Create a new atlas case">Create Case</a> /
|
||||
|
||||
@@ -45,6 +45,16 @@
|
||||
<span>
|
||||
<a href="{% url 'atlas:series_id_create' pk=case.pk %}">Add new series</a><br />
|
||||
<a href="{% url 'atlas:user_uploads_case' case_id=case.pk %}">Import new uploads</a><br />
|
||||
<details>
|
||||
<summary>+</summary>
|
||||
<button hx-get="{% url 'atlas:case_order_dicom' pk=case.pk %}"
|
||||
title="order dicom by slice location"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML">
|
||||
Order all series dicoms by slice location
|
||||
</button>
|
||||
</details>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
{% comment %} <p><b>Scrapped:</b> {{ case.scrapped }} <a
|
||||
|
||||
@@ -204,6 +204,11 @@ urlpatterns = [
|
||||
views.series_anonymise_dicom,
|
||||
name="series_anonymise_dicom",
|
||||
),
|
||||
path(
|
||||
"case/<int:pk>/order_dicom",
|
||||
views.case_order_dicom,
|
||||
name="case_order_dicom",
|
||||
),
|
||||
path(
|
||||
"series/<int:pk>/order_dicom",
|
||||
views.series_order_dicom,
|
||||
|
||||
@@ -1006,6 +1006,27 @@ class FindingView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
|
||||
filterset_class = FindingFilter
|
||||
|
||||
@login_required
|
||||
@user_is_author_or_atlas_series_checker
|
||||
def case_order_dicom(request, pk):
|
||||
if request.htmx:
|
||||
case = get_object_or_404(Case, pk=pk)
|
||||
|
||||
fail = []
|
||||
for series in case.series.all():
|
||||
try:
|
||||
series.order_by_dicom()
|
||||
except:
|
||||
fail.append(series.pk)
|
||||
|
||||
if fail:
|
||||
return HttpResponse(f"Unable to order series {','.join(fail)}")
|
||||
else:
|
||||
return HttpResponse("Series reordered")
|
||||
|
||||
|
||||
raise Http404
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_author_or_atlas_series_checker
|
||||
|
||||
Reference in New Issue
Block a user