From bed14cfa684fc3a97a5bfbd6441dc1ddf2e77346 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Fri, 1 May 2020 16:32:30 +0530 Subject: Delete and recreate question papers when using god mode or user mode --- yaksh/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index a29e910..99cbf70 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1754,7 +1754,8 @@ class QuestionPaperManager(models.Manager): def create_trial_paper_to_test_quiz(self, trial_quiz, original_quiz_id): """Creates a trial question paper to test quiz.""" - trial_quiz.questionpaper_set.all().delete() + if self.filter(quiz=trial_quiz).exists(): + self.get(quiz=trial_quiz).delete() trial_questionpaper, trial_questions = \ self._create_trial_from_questionpaper(original_quiz_id) trial_questionpaper.quiz = trial_quiz -- cgit