summaryrefslogtreecommitdiff
path: root/testapp/exam/views.py
diff options
context:
space:
mode:
authorJay Parikh2013-03-18 15:11:15 +0530
committerJay Parikh2013-03-18 15:11:15 +0530
commitc12f20984aa75751af89a0d6213bc35924bc593b (patch)
tree4608e7b6088a7fb81fc5f9e2e1c021df45eddad4 /testapp/exam/views.py
parent65d4498ff96090fecc569440f0cd1499ae0f6b69 (diff)
downloadonline_test-c12f20984aa75751af89a0d6213bc35924bc593b.tar.gz
online_test-c12f20984aa75751af89a0d6213bc35924bc593b.tar.bz2
online_test-c12f20984aa75751af89a0d6213bc35924bc593b.zip
Added code snippets for questions
Diffstat (limited to 'testapp/exam/views.py')
-rw-r--r--testapp/exam/views.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py
index 49f7bb9..a1e8ece 100644
--- a/testapp/exam/views.py
+++ b/testapp/exam/views.py
@@ -169,6 +169,7 @@ def edit_question(request):
options = request.POST.getlist('options')
type = request.POST.getlist('type')
active = request.POST.getlist('active')
+ snippet = request.POST.getlist('snippet')
tags = request.POST.getlist('tags')
j = 0
for id_list in questions:
@@ -181,6 +182,7 @@ def edit_question(request):
question.type = type[j]
edit_tags=tags[j]
question.active = active[j]
+ question.snippet = snippet[j]
question.save()
for tag in question.tags.all():
question.tags.remove(tag)
@@ -219,6 +221,7 @@ def add_question(request,question_id=None):
d.options = form['options'].data
d.type = form['type'].data
d.active = form['active'].data
+ d.snippet = form['snippet'].data
d.save()
question = Question.objects.get(id=question_id)
for tag in question.tags.all():
@@ -250,6 +253,7 @@ def add_question(request,question_id=None):
form.initial['options'] = d.options
form.initial['type'] = d.type
form.initial['active'] = d.active
+ form.initial['snippet'] = d.snippet
form_tags = d.tags.all()
form_tags_split = form_tags.values('name')
initial_tags = ""