summaryrefslogtreecommitdiff
path: root/testapp/exam/views.py
diff options
context:
space:
mode:
authorprathamesh2014-06-26 15:47:00 +0530
committerprathamesh2014-06-26 15:47:00 +0530
commitbd70b4d7f748eb3f56ac4b8366e02d113c1be3b9 (patch)
treeae4fe2d8629ad3ccf127720054442b6ea088a63f /testapp/exam/views.py
parent7155dd407f48293d46b0fb45e7d2354bd0982f76 (diff)
downloadonline_test-bd70b4d7f748eb3f56ac4b8366e02d113c1be3b9.tar.gz
online_test-bd70b4d7f748eb3f56ac4b8366e02d113c1be3b9.tar.bz2
online_test-bd70b4d7f748eb3f56ac4b8366e02d113c1be3b9.zip
Changes in edit quiz view to set prerequisite
Diffstat (limited to 'testapp/exam/views.py')
-rw-r--r--testapp/exam/views.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index 33bafe6..422e16f 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -188,6 +188,7 @@ 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')
@@ -197,8 +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 = prerequisite[j]
+ quiz.prerequisite_id = prerequisite[j]
quiz.save()
return my_redirect("/exam/manage/showquiz/")
@@ -326,8 +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 = form['prerequisite'].data
+ d.prerequisite_id = form['prerequisite'].data
d.save()
quiz = Quiz.objects.get(id=quiz_id)
return my_redirect("/exam/manage/showquiz")
@@ -348,6 +351,7 @@ 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',
@@ -918,8 +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.description
+ form.initial['prerequisite'] = d.prerequisite_id
forms.append(form)
return my_render_to_response('exam/edit_quiz.html',
{'forms': forms, 'data': data},