summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2017-03-10 17:44:16 +0530
committeradityacp2017-03-10 19:02:01 +0530
commitf568762320caa8f57b83f34d02e3b3f5db3b1e45 (patch)
tree8aaf301211d1a89d1fab582135521f8639a0c6b8
parentec507b9a977811cfb9909e50133120476eaa9c6c (diff)
downloadonline_test-f568762320caa8f57b83f34d02e3b3f5db3b1e45.tar.gz
online_test-f568762320caa8f57b83f34d02e3b3f5db3b1e45.tar.bz2
online_test-f568762320caa8f57b83f34d02e3b3f5db3b1e45.zip
Fix test questions method in QuestionPaper model
-rw-r--r--yaksh/models.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index c5e73f6..2569892 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -635,10 +635,8 @@ class QuestionPaperManager(models.Manager):
trial_questionpaper = self.create(quiz=trial_quiz,
total_marks=10,
)
- for q_id in questions_list:
- que = Question.objects.get(id=q_id)
- FixedQuestions.objects.add_fixed_questions(
- trial_questionpaper, que)
+ trial_questionpaper.fixed_question_order = ",".join(questions_list)
+ trial_questionpaper.fixed_questions.add(*questions_list)
return trial_questionpaper
def create_trial_paper_to_test_quiz(self, trial_quiz, original_quiz_id):
@@ -647,8 +645,7 @@ class QuestionPaperManager(models.Manager):
trial_questionpaper = self.get(quiz=trial_quiz)
else:
trial_questionpaper, trial_questions = \
- self._create_trial_from_questionpaper(original_quiz_id,
- )
+ self._create_trial_from_questionpaper(original_quiz_id)
trial_questionpaper.quiz = trial_quiz
trial_questionpaper.fixed_questions\
.add(*trial_questions["fixed_questions"])
@@ -757,7 +754,7 @@ class QuestionPaper(models.Model):
summary="Yaksh Demo Question",
user=user)
q_order = [str(que.id) for que in questions]
- question_paper.fixed_questions_order = ",".join(q_order)
+ question_paper.fixed_question_order = ",".join(q_order)
question_paper.save()
# add fixed set of questions to the question paper
question_paper.fixed_questions.add(*questions)