From 27e575f7724d3981f09174df657262d544456e95 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 27 Oct 2025 10:38:49 +0000 Subject: [PATCH] Add QuestionReviewForm to question review view and update template to include form --- generic/views.py | 13 ++++++------- sbas/templates/sbas/question_review_question.html | 4 ++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/generic/views.py b/generic/views.py index 5e6657b2..988bfbe4 100644 --- a/generic/views.py +++ b/generic/views.py @@ -68,6 +68,7 @@ from .forms import ( CidUserExamForm, ExamCollectionCloneForm, ExamCollectionForm, + QuestionReviewForm, ExaminationForm, CidUserGroupForm, ExaminationMergeForm, @@ -96,8 +97,10 @@ from .models import ( UserProfile, UserUserGroup, get_next_cid, + QuestionReview, ) + from rapids.models import ( Rapid as RapidQuestion, ExamQuestionDetail as RapidsExamQuestionDetail, @@ -2954,9 +2957,6 @@ class GenericViewBase: GET: renders the current review block or the form (if ?edit=1) POST: creates a new QuestionReview and returns the rendered block """ - from django.contrib.contenttypes.models import ContentType - from generic.models import QuestionReview - from .forms import QuestionReviewForm logger.debug("question_set_review called") @@ -3018,8 +3018,6 @@ class GenericViewBase: def question_reviews_list(self, request, pk): """Return a partial listing all QuestionReview instances for a question.""" - from django.contrib.contenttypes.models import ContentType - from generic.models import QuestionReview question = get_object_or_404(self.question_object, pk=pk) @@ -3072,7 +3070,6 @@ class GenericViewBase: - status: one of the status codes (AC, OD, ER, RJ, IP), or 'UNREVIEWED' or 'ANY' """ from django.contrib.contenttypes.models import ContentType - from generic.models import QuestionReview # Read filters category = request.POST.get("category") or request.GET.get("category") @@ -3124,7 +3121,9 @@ class GenericViewBase: match = True if match: - return render(request, f"{self.app_name}/question_review_question.html", {"question": question}) + + form = QuestionReviewForm() + return render(request, f"{self.app_name}/question_review_question.html", {"question": question, "form": form, "app_name": self.app_name}) # Nothing found - render complete page return render(request, f"{self.app_name}/question_review_complete.html", {"app_name": self.app_name}) diff --git a/sbas/templates/sbas/question_review_question.html b/sbas/templates/sbas/question_review_question.html index c2556bbf..425a11d9 100644 --- a/sbas/templates/sbas/question_review_question.html +++ b/sbas/templates/sbas/question_review_question.html @@ -54,6 +54,10 @@ {% endif %} +{% comment %} Add Review {% endcomment %} +
+ {% include 'generic/partials/question_review_form.html' with app_name='sbas' question=question form=form %} +
{% endblock %} \ No newline at end of file