From 7155dd407f48293d46b0fb45e7d2354bd0982f76 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Thu, 26 Jun 2014 15:09:42 +0530 Subject: Changes made to quiz form to accept prerequisite quiz. --- testapp/exam/views.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'testapp/exam/views.py') diff --git a/testapp/exam/views.py b/testapp/exam/views.py index 7353d82..33bafe6 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -188,6 +188,8 @@ def edit_quiz(request): duration = request.POST.getlist('duration') active = request.POST.getlist('active') description = request.POST.getlist('description') + 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 +197,8 @@ def edit_quiz(request): quiz.duration = duration[j] quiz.active = active[j] quiz.description = description[j] + quiz.language = language[j] + quiz.prerequisite = prerequisite[j] quiz.save() return my_redirect("/exam/manage/showquiz/") @@ -322,6 +326,8 @@ def add_quiz(request, quiz_id=None): d.duration = form['duration'].data d.active = form['active'].data d.description = form['description'].data + d.language = form['language'].data + d.prerequisite = form['prerequisite'].data d.save() quiz = Quiz.objects.get(id=quiz_id) return my_redirect("/exam/manage/showquiz") @@ -342,6 +348,8 @@ def add_quiz(request, quiz_id=None): form.initial['duration'] = d.duration form.initial['description'] = d.description form.initial['active'] = d.active + 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 +918,8 @@ def show_all_quiz(request): form.initial['duration'] = d.duration form.initial['active'] = d.active form.initial['description'] = d.description + form.initial['language'] = d.language + form.initial['prerequisite'] = d.prerequisite.description forms.append(form) return my_render_to_response('exam/edit_quiz.html', {'forms': forms, 'data': data}, -- cgit