Add debug logging for POST requests in generic_exam_htmx and update exam selection form to include checked selections
This commit is contained in:
@@ -599,6 +599,7 @@ def generic_exam_htmx(request):
|
|||||||
return render(request, "generic/partials/exam_select_fragment.html", {"exams": exams, "type": question_type})
|
return render(request, "generic/partials/exam_select_fragment.html", {"exams": exams, "type": question_type})
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
logger.debug(f"generic_exam_htmx POST: {request.POST}")
|
||||||
question_type = request.POST.get("type")
|
question_type = request.POST.get("type")
|
||||||
if not question_type:
|
if not question_type:
|
||||||
return JsonResponse({"status": "error", "message": "missing type"}, status=400)
|
return JsonResponse({"status": "error", "message": "missing type"}, status=400)
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form hx-post="{% url 'generic:generic_exam_htmx' %}" hx-target="#action-result" hx-swap="innerHTML">
|
<form hx-post="{% url 'generic:generic_exam_htmx' %}"
|
||||||
|
hx-target="#action-result" hx-swap="innerHTML"
|
||||||
|
hx-include="[name='selection']:checked"
|
||||||
|
>
|
||||||
<input type="hidden" name="type" value="{{ type }}" />
|
<input type="hidden" name="type" value="{{ type }}" />
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<label for="id_exam_id">Choose exam</label>
|
<label for="id_exam_id">Choose exam</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user