quiz/views.py
changeset 18 c66b4904ce5a
parent 17 68c2932660b7
child 19 4911302379ac
equal deleted inserted replaced
17:68c2932660b7 18:c66b4904ce5a
    69             return render_to_response('register.html',{'form':form})
    69             return render_to_response('register.html',{'form':form})
    70     else:
    70     else:
    71         form = UserRegisterForm()
    71         form = UserRegisterForm()
    72         return render_to_response('register.html',{'form':form})
    72         return render_to_response('register.html',{'form':form})
    73 
    73 
    74 def start_quiz(request, username):
    74 def start_quiz(request):
    75     """ get the user by his username.
    75     """ get the user by his username.
    76     then check for the event quiz status
    76     then check for the event quiz status
    77     then check if his ip has finished the quiz
    77     then check if his ip has finished the quiz
    78     then make his quiz paper and redirect to the right question.
    78     then make his quiz paper and redirect to the right question.
    79     """
    79     """
    80 
    80 
    81     user = request.user
    81     user = request.user
    82     if not user.username == username:
    82     if not user.is_authenticated():
    83         raise Http404
    83         raise Http404
    84 
    84 
    85     try:
    85     try:
    86         event = Event.objects.all()[0]
    86         event = Event.objects.all()[0]
    87     except IndexError:
    87     except IndexError: