diff options
author | ankitjavalkar | 2020-05-01 16:32:30 +0530 |
---|---|---|
committer | ankitjavalkar | 2021-01-04 11:21:26 +0530 |
commit | bed14cfa684fc3a97a5bfbd6441dc1ddf2e77346 (patch) | |
tree | 28966f9c74ce684926047a8a5611a16112824778 /yaksh/models.py | |
parent | 30dd519ba7a5277348960a696f3a7cbd91f3f72f (diff) | |
download | online_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/models.py')
-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 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 |