.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from sbas.forms import CidUserAnswerForm
|
||||
from django.shortcuts import render, get_object_or_404, redirect
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django import forms
|
||||
@@ -251,6 +252,13 @@ def exam_take(request, pk, sk, cid):
|
||||
|
||||
pos = exam.get_question_index(question) + 1
|
||||
|
||||
form = CidUserAnswerForm(request.POST or None)
|
||||
if form.is_valid():
|
||||
if "next" in request.POST:
|
||||
return redirect("sbas:exam_take", pk=pk, sk=n + 1, cid=cid)
|
||||
elif "previous" in request.POST:
|
||||
return redirect("sbas:exam_take", pk=pk, sk=n - 1, cid=cid)
|
||||
|
||||
previous = -1
|
||||
if sk > 0:
|
||||
previous = sk - 1
|
||||
@@ -263,6 +271,7 @@ def exam_take(request, pk, sk, cid):
|
||||
request,
|
||||
"sbas/exam_take.html",
|
||||
{
|
||||
"form": form,
|
||||
"cid": cid,
|
||||
"exam": exam,
|
||||
"questions": question,
|
||||
|
||||
Reference in New Issue
Block a user