summaryrefslogtreecommitdiff
path: root/testapp/exam/views.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2014-06-27 19:41:15 +0530
committerPrabhu Ramachandran2014-06-27 19:41:15 +0530
commit6f27cd40d63300e3294e170daee8c058788c5fa0 (patch)
tree624b03be9921098aeffaea845b857cc357a66705 /testapp/exam/views.py
parentfa402a2c9a34a1728f863ddcbab62fa8e030099e (diff)
parent3c82dd0faf2f1273cb590b360a9696a973b30720 (diff)
downloadonline_test-6f27cd40d63300e3294e170daee8c058788c5fa0.tar.gz
online_test-6f27cd40d63300e3294e170daee8c058788c5fa0.tar.bz2
online_test-6f27cd40d63300e3294e170daee8c058788c5fa0.zip
Merge pull request #26 from prathamesh920/model_modification
Model modification
Diffstat (limited to 'testapp/exam/views.py')
-rw-r--r--testapp/exam/views.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index 7353d82..422e16f 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -188,6 +188,9 @@ def edit_quiz(request):
duration = request.POST.getlist('duration')
active = request.POST.getlist('active')
description = request.POST.getlist('description')
+ pass_criteria = request.POST.getlist('pass_criteria')
+ language = request.POST.getlist('language')
+ prerequisite = request.POST.getlist('prerequisite')
for j, quiz_id in enumerate(quiz_list):
quiz = Quiz.objects.get(id=quiz_id)
@@ -195,6 +198,9 @@ def edit_quiz(request):
quiz.duration = duration[j]
quiz.active = active[j]
quiz.description = description[j]
+ quiz.pass_criteria = pass_criteria[j]
+ quiz.language = language[j]
+ quiz.prerequisite_id = prerequisite[j]
quiz.save()
return my_redirect("/exam/manage/showquiz/")
@@ -322,6 +328,9 @@ def add_quiz(request, quiz_id=None):
d.duration = form['duration'].data
d.active = form['active'].data
d.description = form['description'].data
+ d.pass_criteria = form['pass_criteria'].data
+ d.language = form['language'].data
+ d.prerequisite_id = form['prerequisite'].data
d.save()
quiz = Quiz.objects.get(id=quiz_id)
return my_redirect("/exam/manage/showquiz")
@@ -342,6 +351,9 @@ def add_quiz(request, quiz_id=None):
form.initial['duration'] = d.duration
form.initial['description'] = d.description
form.initial['active'] = d.active
+ form.initial['pass_criteria'] = d.pass_criteria
+ form.initial['language'] = d.language
+ form.initial['prerequisite'] = d.prerequisite_id
return my_render_to_response('exam/add_quiz.html',
{'form': form},
context_instance=ci)
@@ -910,6 +922,9 @@ def show_all_quiz(request):
form.initial['duration'] = d.duration
form.initial['active'] = d.active
form.initial['description'] = d.description
+ form.initial['pass_criteria'] = d.pass_criteria
+ form.initial['language'] = d.language
+ form.initial['prerequisite'] = d.prerequisite_id
forms.append(form)
return my_render_to_response('exam/edit_quiz.html',
{'forms': forms, 'data': data},