Add Procedure model integration: create views, forms, and templates; update URLs and search functionality

This commit is contained in:
Ross
2026-02-16 14:15:28 +00:00
parent 6e3ab7de41
commit 44d23801b2
9 changed files with 138 additions and 9 deletions
@@ -18,6 +18,8 @@
<a href="{% url 'atlas:subspecialty_detail' item.pk %}">{{ item.name }}</a>
{% elif group_name == 'presentations' %}
<a href="{% url 'atlas:presentation_detail' item.pk %}">{{ item.name }}</a>
{% elif group_name == 'procedures' %}
<a href="{% url 'atlas:procedure_detail' item.pk %}">{{ item.name }}</a>
{% else %}
{{ item.name }}
{% endif %}
@@ -27,7 +29,7 @@
{% endif %}
{% endfor %}
{% if not results.conditions.exists and not results.findings.exists and not results.structures.exists and not results.subspecialties.exists and not results.presentations.exists %}
{% if not results.conditions.exists and not results.findings.exists and not results.structures.exists and not results.subspecialties.exists and not results.presentations.exists and not results.procedures.exists %}
<p class="text-muted">No matches found.</p>
{% endif %}
</div>
+2
View File
@@ -90,6 +90,7 @@
<li><a class="dropdown-item" href="{% url 'atlas:subspecialty_view' %}">Subspecialties</a></li>
<li><a class="dropdown-item" href="{% url 'atlas:presentation_view' %}">Presentations</a></li>
<li><a class="dropdown-item" href="{% url 'atlas:pathological_process_view' %}">Pathological process</a></li>
<li><a class="dropdown-item" href="{% url 'atlas:procedure_view' %}">Procedures</a></li>
{% if request.user.is_staff %}
<li><hr class="dropdown-divider"></li>
<li class="dropdown-item-text small text-muted px-3">Create</li>
@@ -99,6 +100,7 @@
<li><a class="dropdown-item" href="{% url 'atlas:subspecialty_create' %}">New subspecialty</a></li>
<li><a class="dropdown-item" href="{% url 'atlas:presentation_create' %}">New presentation</a></li>
<li><a class="dropdown-item" href="{% url 'atlas:pathological_process_create' %}">New pathological process</a></li>
<li><a class="dropdown-item" href="{% url 'atlas:procedure_create' %}">New procedure</a></li>
{% endif %}
</ul>
</li>
@@ -10,6 +10,7 @@
<li><a href="{% url 'atlas:subspecialty_view' %}">Subspecialties</li></a>
<li><a href="{% url 'atlas:presentation_view' %}">Presentations</li></a>
<li><a href="{% url 'atlas:pathological_process_view' %}">Pathological Process</li></a>
<li><a href="{% url 'atlas:procedure_view' %}">Procedures</a></li>
</ul>
<div class="mt-4 mb-3">
@@ -94,6 +95,15 @@
hx-indicator="#category-search-loading" />
<label class="form-check-label" for="type-presentations">Presentations</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="type-procedures" name="types" value="procedures" checked
hx-get="{% url 'atlas:categories_search_partial' %}"
hx-target="#category-search-results"
hx-swap="innerHTML"
hx-include="#category-search-form"
hx-indicator="#category-search-loading" />
<label class="form-check-label" for="type-procedures">Procedures</label>
</div>
</div>
</div>
</div>
+23
View File
@@ -0,0 +1,23 @@
{% extends "atlas/base.html" %}
{% load crispy_forms_tags %}
{% block js %}
{{ form.media }}
{% endblock %}
{% block content %}
<h2>Add / Edit Procedure</h2>
<p>Use this form to create or edit a procedure.</p>
<p>Please check if it already <a href='{% url "atlas:procedure_view" %}'>exists</a> before doing so!</p>
<form action="" method="post" enctype="multipart/form-data" id="procedure-form">
{% csrf_token %}
{% crispy form %}
<div class="mt-3">
<button type="submit" class="btn btn-primary">Submit</button>
<a class="btn btn-secondary ms-2" href="{% url 'atlas:procedure_view' %}">Cancel</a>
</div>
</form>
{% endblock %}