From 333859a8c1ab57e70ea57e92a22eaac6a1a1c0ac Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 22 Feb 2018 18:05:00 +0530 Subject: Change templates, test_views.py, urls.py, views.py - Change copy_type to shallow and deep --- yaksh/views.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'yaksh/views.py') diff --git a/yaksh/views.py b/yaksh/views.py index 62a448c..b4b0c76 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -399,18 +399,18 @@ def prof_manage(request, msg=None): if request.method == "POST": delete_paper = request.POST.getlist('delete_paper') for answerpaper_id in delete_paper: - answerpaper = AnswerPaper.objects.filter(id=answerpaper_id) - if answerpaper.exists(): - qpaper = answerpaper.first().question_paper - answerpaper.first().course.remove_trial_modules() - answerpaper.first().course.delete() - if qpaper.quiz.is_trial: + answerpaper = AnswerPaper.objects.get(id=answerpaper_id) + qpaper = answerpaper.question_paper + answerpaper.course.remove_trial_modules() + answerpaper.course.delete() + if qpaper.quiz.is_trial: + qpaper.quiz.delete() + else: + if qpaper.answerpaper_set.count() == 1: qpaper.quiz.delete() else: - if qpaper.answerpaper_set.count() == 1: - qpaper.quiz.delete() - else: - answerpaper.delete() + answerpaper.delete() + context = {'user': user, 'courses': courses, 'trial_paper': trial_paper, 'msg': msg } @@ -2253,7 +2253,7 @@ def duplicate_course(request, copy_type, course_id): raise Http404('You are not allowed to view this page!') if course.is_teacher(user) or course.is_creator(user): - if copy_type == "copy": + if copy_type == "shallow": # Link all the modules from current course to copied course course.create_duplicate_course(user) else: -- cgit