diff options
-rw-r--r-- | exam/views.py | 4 | ||||
-rw-r--r-- | templates/exam/question.html | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/exam/views.py b/exam/views.py index f30398a..52c5664 100644 --- a/exam/views.py +++ b/exam/views.py @@ -125,6 +125,8 @@ def start(request): def question(request, q_id): user = request.user + if not user.is_authenticated(): + return redirect('exam/login/') q = get_object_or_404(Question, pk=q_id) try: paper = QuestionPaper.objects.get(user=request.user) @@ -151,6 +153,8 @@ def show_question(request, q_id): def check(request, q_id): user = request.user + if not user.is_authenticated(): + return redirect('exam/login/') question = get_object_or_404(Question, pk=q_id) paper = QuestionPaper.objects.get(user=user) answer = request.POST.get('answer') diff --git a/templates/exam/question.html b/templates/exam/question.html index fe27e8f..226bdca 100644 --- a/templates/exam/question.html +++ b/templates/exam/question.html @@ -38,7 +38,7 @@ function update_time() setTimeout("update_time()", 1000); } else { - document.forms["logout"].submit(); + document.forms["code"].submit(); } } //--> @@ -83,4 +83,4 @@ you have {{ paper.questions_left }} question(s) left in {{ quiz_name }}.</p> <input type="submit" name="quit" value="Quit exam and logout" /> </form> -{% endblock content %}
\ No newline at end of file +{% endblock content %} |