From f569c1f1cea65f744f42941b5d7e75b49350d442 Mon Sep 17 00:00:00 2001 From: Nishanth Amuluru Date: Thu, 10 Nov 2011 22:10:26 +0530 Subject: Users will be directed to the exam automatically after they register --- exam/forms.py | 2 +- exam/views.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'exam') diff --git a/exam/forms.py b/exam/forms.py index 7ee4b0e..38466e8 100644 --- a/exam/forms.py +++ b/exam/forms.py @@ -62,7 +62,7 @@ class UserRegisterForm(forms.Form): new_profile.roll_number = self.cleaned_data["roll_number"] new_profile.save() - return new_user + return u_name, pwd class UserLoginForm(forms.Form): username = forms.CharField(max_length = 30) diff --git a/exam/views.py b/exam/views.py index 43ac388..7ee3c53 100644 --- a/exam/views.py +++ b/exam/views.py @@ -38,13 +38,11 @@ def user_register(request): form = UserRegisterForm(request.POST) if form.is_valid(): data = form.cleaned_data - new_user = form.save() + u_name, pwd = form.save() - context = {} - context['full_name'] = new_user.first_name.title() + " " + \ - new_user.last_name.title() - return render_to_response('exam/register.html', context, - context_instance=RequestContext(request)) + new_user = authenticate(username = u_name, password = pwd) + login(request, new_user) + return redirect("/exam/start/") else: return render_to_response('exam/register.html',{'form':form}, -- cgit