diff options
author | jayparikh111 | 2012-02-16 13:02:49 +0530 |
---|---|---|
committer | jayparikh111 | 2012-02-16 13:02:49 +0530 |
commit | c20539ed5f879c945cc89323e00daad96047d247 (patch) | |
tree | 928b82fef403682ebc12251865d47441bd57b41c /testapp/exam/views.py | |
parent | d18df85469fc993520ee397f4a28b422c550408a (diff) | |
download | online_test-c20539ed5f879c945cc89323e00daad96047d247.tar.gz online_test-c20539ed5f879c945cc89323e00daad96047d247.tar.bz2 online_test-c20539ed5f879c945cc89323e00daad96047d247.zip |
Form to add New Question
Diffstat (limited to 'testapp/exam/views.py')
-rw-r--r-- | testapp/exam/views.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py index 22e701e..23534f5 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -14,7 +14,7 @@ from django.db.models import Sum # Local imports. from exam.models import Quiz, Question, QuestionPaper, Profile, Answer, User -from exam.forms import UserRegisterForm, UserLoginForm, QuizForm +from exam.forms import UserRegisterForm, UserLoginForm, QuizForm , AddQuestionForm from exam.xmlrpc_clients import code_server from settings import URL_ROOT @@ -91,7 +91,22 @@ def user_register(request): context_instance=RequestContext(request)) def add_question(request): - return render_to_response('exam/add_question.html',{}) + + if request.method == "POST": + form = AddQuestionForm(request.POST) + if form.is_valid(): + data = form.cleaned_data + return my_redirect("/exam/start/") + + else: + return my_render_to_response('exam/add_question.html', + {'form':form}, + context_instance=RequestContext(request)) + else: + form = AddQuestionForm() + return my_render_to_response('exam/add_question.html', + {'form':form}, + context_instance=RequestContext(request)) def add_quiz(request): |