Enhance bulk add groups form with crispy forms for improved styling and usability

This commit is contained in:
Ross
2025-11-12 21:23:41 +00:00
parent ec0245fe7c
commit da04138861
2 changed files with 33 additions and 12 deletions
@@ -1,17 +1,11 @@
{% load crispy_forms_tags %}
<form hx-post="{% url 'generic:exam_collection_bulk_add_groups' collection.pk %}" hx-target="#bulk-add-groups" hx-swap="innerHTML" class="bulk-add-groups-form">
{% csrf_token %}
<div>
{{ form.cid_user_groups.label_tag }}<br/>
{{ form.cid_user_groups }}
</div>
<div>
{{ form.user_user_groups.label_tag }}<br/>
{{ form.user_user_groups }}
</div>
<div>
{{ form.exam_types.label_tag }}<br/>
{{ form.exam_types }}
</div>
{# Render fields with crispy. The form helper sets form_tag=False so the surrounding
<form> keeps the HTMX attributes while crispy renders nicely styled fields. #}
{{ form|crispy }}
<div class="mt-2">
<button type="submit" class="btn btn-primary btn-sm">Add groups</button>
<button type="button" class="btn btn-secondary btn-sm" hx-get="{% url 'generic:examcollection_detail' collection.pk %}" hx-target="#bulk-add-groups" hx-swap="innerHTML">Cancel</button>