From 467adb5d403e7dd29a83f44d06c80cdca8b4e7a1 Mon Sep 17 00:00:00 2001 From: jayparikh111 Date: Thu, 16 Feb 2012 15:37:20 +0530 Subject: Form to add New Quiz --- testapp/exam/views.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'testapp/exam/views.py') diff --git a/testapp/exam/views.py b/testapp/exam/views.py index 23534f5..1c5d2e5 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -109,24 +109,20 @@ def add_question(request): context_instance=RequestContext(request)) def add_quiz(request): - if request.method == "POST": form = QuizForm(request.POST) if form.is_valid(): data = form.cleaned_data - u_name, pwd = form.save() - - new_user = authenticate(username = u_name, password = pwd) - login(request, new_user) - return my_redirect("/exam/manage/add_quiz") + form.save() + return my_redirect("/exam/manage/addquiz") else: - return my_render_to_response('exam/add_quiz.html', + return my_render_to_response('exam/addquiz.html', {'form':form}, context_instance=RequestContext(request)) else: form = QuizForm() - return my_render_to_response('exam/add_quiz.html', + return my_render_to_response('exam/addquiz.html', {'form':form}, context_instance=RequestContext(request)) -- cgit