diff options
author | ankitjavalkar | 2021-01-11 10:31:29 +0530 |
---|---|---|
committer | GitHub | 2021-01-11 10:31:29 +0530 |
commit | 99d69b5647f9cfc5686a7556768d591c05bda086 (patch) | |
tree | a016263748bc1cfe260182849caa200fe2b7f8d8 | |
parent | eb01109de13d6de6e87edc72526f7aec8539802f (diff) | |
parent | bed14cfa684fc3a97a5bfbd6441dc1ddf2e77346 (diff) | |
download | online_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.py | 3 |
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 |