Add sorting functionality to normal cases list with user-selected options

This commit is contained in:
Ross
2026-03-02 11:38:17 +00:00
parent 7cac5aa60f
commit 2c6d0f2613
2 changed files with 44 additions and 4 deletions
+9 -3
View File
@@ -19,7 +19,13 @@
<div class="col-12">
<form method="get" class="form-inline">
{% crispy filter.form %}
<div class="mb-2">
<div class="mb-2 d-flex flex-wrap gap-2 align-items-center">
<label class="mb-0" for="id_sort">Sort by</label>
<select class="form-select w-auto" id="id_sort" name="sort">
{% for value, label in sort_choices %}
<option value="{{ value }}" {% if selected_sort == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
<button class="btn btn-primary" type="submit">Filter</button>
<a class="btn btn-link" href="?">Clear</a>
</div>
@@ -65,11 +71,11 @@
<nav aria-label="Page navigation">
<ul class="pagination mt-3">
{% if page_obj.has_previous %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a></li>
<li class="page-item"><a class="page-link" href="?{% if querystring_without_page %}{{ querystring_without_page }}&amp;{% endif %}page={{ page_obj.previous_page_number }}">Previous</a></li>
{% endif %}
<li class="page-item disabled"><span class="page-link">Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span></li>
{% if page_obj.has_next %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a></li>
<li class="page-item"><a class="page-link" href="?{% if querystring_without_page %}{{ querystring_without_page }}&amp;{% endif %}page={{ page_obj.next_page_number }}">Next</a></li>
{% endif %}
</ul>
</nav>