summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authorankitjavalkar2020-05-01 16:32:30 +0530
committerankitjavalkar2021-01-04 11:21:26 +0530
commitbed14cfa684fc3a97a5bfbd6441dc1ddf2e77346 (patch)
tree28966f9c74ce684926047a8a5611a16112824778 /yaksh
parent30dd519ba7a5277348960a696f3a7cbd91f3f72f (diff)
downloadonline_test-bed14cfa684fc3a97a5bfbd6441dc1ddf2e77346.tar.gz
online_test-bed14cfa684fc3a97a5bfbd6441dc1ddf2e77346.tar.bz2
online_test-bed14cfa684fc3a97a5bfbd6441dc1ddf2e77346.zip
Delete and recreate question papers when using god mode or user mode
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py3
1 files changed, 2 insertions, 1 deletions
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