Refactor exam review question template to support HTMX navigation and create a partial for question details

This commit is contained in:
Ross
2025-11-08 22:10:21 +00:00
parent 321c7ef895
commit 0f571d8f5c
3 changed files with 42 additions and 23 deletions
+6
View File
@@ -1216,6 +1216,12 @@ class ExamViews(View, LoginRequiredMixin):
"can_edit": self.check_user_edit_access(request.user, exam_id=pk),
}
# If this is an HTMX request, return only the fragment so the client
# can swap it into the page. HTMX sends the HX-Request header which
# is available in Django as HTTP_HX_REQUEST in request.META.
if request.META.get("HTTP_HX_REQUEST") == "true":
return render(request, "generic/partials/exam_review_question_fragment.html", context)
return render(request, "generic/exam_review_question.html", context)
@method_decorator(login_required)