quiz/views.py
changeset 24 2368bb63ee39
parent 21 ff6d34fc7137
child 29 ea1c0110e989
equal deleted inserted replaced
23:f57c30096b51 24:2368bb63ee39
    29     if event.quiz_status == '00':
    29     if event.quiz_status == '00':
    30         raise Http404
    30         raise Http404
    31 
    31 
    32     user = request.user
    32     user = request.user
    33     if user.is_authenticated():
    33     if user.is_authenticated():
    34         return redirect("/quiz/start/%s"%user.username)
    34         return redirect("/quiz/start/")
    35     else:
    35     else:
    36         try:
    36         try:
    37             ip = request.META['REMOTE_ADDR']
    37             ip = request.META['REMOTE_ADDR']
    38             Quiz.objects.get(user_ip=ip, quiz_num=event.quiz_status)
    38             Quiz.objects.get(user_ip=ip, quiz_num=event.quiz_status)
    39             return redirect("/quiz/complete")
    39             return redirect("/quiz/complete")
    62             new_profile.affiliated_to = data['affiliated_to']
    62             new_profile.affiliated_to = data['affiliated_to']
    63             new_profile.save()
    63             new_profile.save()
    64 
    64 
    65             user = authenticate(username=username, password="123")
    65             user = authenticate(username=username, password="123")
    66             login(request, user)
    66             login(request, user)
    67             return redirect("/quiz/start/%s"%username)
    67             return redirect("/quiz/start/")
    68 
    68 
    69         else:
    69         else:
    70             return render_to_response('register.html',{'form':form})
    70             return render_to_response('register.html',{'form':form})
    71     else:
    71     else:
    72         form = UserRegisterForm()
    72         form = UserRegisterForm()