Add skip and next buttons to question review with corresponding JavaScript functionality

This commit is contained in:
Ross
2025-10-27 11:54:02 +00:00
parent a38c31ca87
commit 511b3c3777
3 changed files with 54 additions and 1 deletions
+11
View File
@@ -3073,6 +3073,13 @@ class GenericViewBase:
# Read filters
category = request.POST.get("category") or request.GET.get("category")
status = request.POST.get("status") or request.GET.get("status") or "ANY"
# How many matching questions to skip (useful for Skip button). Expected integer >= 0.
try:
skip = int(request.POST.get("skip") or request.GET.get("skip") or 0)
if skip < 0:
skip = 0
except Exception:
skip = 0
# Build base queryset of questions for this app
qs = self.question_object.objects.all().order_by("pk")
@@ -3120,6 +3127,10 @@ class GenericViewBase:
match = True
if match:
# If caller asked us to skip N matches, decrement and continue until skip==0
if skip and skip > 0:
skip -= 1
continue
form = QuestionReviewForm()
return render(request, f"{self.app_name}/question_review_question.html", {"question": question, "form": form, "app_name": self.app_name, "filters": {"category": category, "status": status}})