Refactor exam review question template to support HTMX navigation and create a partial for question details
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user