summaryrefslogtreecommitdiff
path: root/exam
diff options
context:
space:
mode:
authorPrabhu Ramachandran2011-11-18 15:54:33 +0530
committerPrabhu Ramachandran2011-11-18 15:54:33 +0530
commit802a4d94dc261911e421124b102e6e42bef9e04b (patch)
tree109713a8bf62cb5f38ec5a634e3c83d73615878b /exam
parent3d9a6bc68e5fbf9093a7ea926c7431e93775d8d3 (diff)
downloadonline_test-802a4d94dc261911e421124b102e6e42bef9e04b.tar.gz
online_test-802a4d94dc261911e421124b102e6e42bef9e04b.tar.bz2
online_test-802a4d94dc261911e421124b102e6e42bef9e04b.zip
BUG: Submit code when time is done
Also check if user is authenticated or not when displaying question or checking.
Diffstat (limited to 'exam')
-rw-r--r--exam/views.py4
1 files changed, 4 insertions, 0 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')