Enhance NormalCase functionality: prepopulate age fields on edit, update author handling in create case normal view, and refine template logic for editing permissions

This commit is contained in:
Ross
2026-02-16 13:45:10 +00:00
parent 0b6661c018
commit 36da045d71
4 changed files with 33 additions and 16 deletions
+12 -12
View File
@@ -32,18 +32,18 @@
{% for normal in page_obj.object_list %}
<div class="list-group-item d-flex justify-content-between align-items-start">
<a class="flex-grow-1 text-decoration-none text-reset" href="{% url 'atlas:case_detail' normal.case.pk %}">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ normal.case.title }}</h5>
<small class="text-muted">{{ normal.added_date|date:"Y-m-d" }}</small>
</div>
<p class="mb-1">
Age: {{ normal.display_age }}
{% if normal.examination %} • Exam: {{ normal.examination }}{% endif %}
{% if normal.modality %} • Modality: {{ normal.modality }}{% endif %}
</p>
{% if normal.notes %}
<p class="mb-0 text-muted">{{ normal.notes }}</p>
{% endif %}
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ normal.case.title }}</h5>
<small class="text-muted">{{ normal.added_date|date:"Y-m-d" }}</small>
</div>
<p class="mb-1">
Age: {{ normal.display_age }}
{% if normal.examination %} • Exam: {{ normal.examination }}{% endif %}
{% if normal.modality %} • Modality: {{ normal.modality }}{% endif %}
</p>
{% if normal.notes %}
<p class="mb-0 text-muted">{{ normal.notes }}</p>
{% endif %}
</a>
<div class="ms-2">
{% if request.user.is_superuser or request.user in normal.author.all %}
@@ -15,8 +15,7 @@
</button>
{% endif %}
{# Allow NormalCase authors (or atlas editors/superusers) to edit the Normal metadata #}
{% if case.normal_case and (request.user.is_superuser or request.user in case.normal_case.author.all or can_edit) %}
{% if request.user.is_superuser or can_edit or request.user in case.normal_case.author.all %}
<button class="btn btn-sm btn-outline-secondary ms-2"
hx-get="{% url 'atlas:case_normal_edit' case.normal_case.pk %}"
hx-target="body"