summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorankitjavalkar2021-01-11 10:31:29 +0530
committerGitHub2021-01-11 10:31:29 +0530
commit99d69b5647f9cfc5686a7556768d591c05bda086 (patch)
treea016263748bc1cfe260182849caa200fe2b7f8d8
parenteb01109de13d6de6e87edc72526f7aec8539802f (diff)
parentbed14cfa684fc3a97a5bfbd6441dc1ddf2e77346 (diff)
downloadonline_test-99d69b5647f9cfc5686a7556768d591c05bda086.tar.gz
online_test-99d69b5647f9cfc5686a7556768d591c05bda086.tar.bz2
online_test-99d69b5647f9cfc5686a7556768d591c05bda086.zip
Merge pull request #701 from ankitjavalkar/godmode-fix
Delete and recreate question papers when using god mode or user mode
-rw-r--r--yaksh/models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 73fbb66..f8458f3 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1753,7 +1753,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