diff options
author | maheshgudi | 2017-10-25 13:16:16 +0530 |
---|---|---|
committer | maheshgudi | 2017-10-25 13:16:16 +0530 |
commit | eaf1735f748279f3c9c313375c51f2f886292934 (patch) | |
tree | 57bbcb78ac88ddedd2f3544e115680fe0ab0a028 /yaksh/models.py | |
parent | 52c0408298a5559cb24f7e2f4251b207546c7d22 (diff) | |
parent | e45b9cce359567c28001b34e1ccd14b51130cdb3 (diff) | |
download | online_test-eaf1735f748279f3c9c313375c51f2f886292934.tar.gz online_test-eaf1735f748279f3c9c313375c51f2f886292934.tar.bz2 online_test-eaf1735f748279f3c9c313375c51f2f886292934.zip |
Merge branch '0.7_bugfix' of https://github.com/maheshgudi/online_test into 0.7_bugfix
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 39a2a7a..87f153c 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -420,9 +420,11 @@ class Question(models.Model): msg = "Questions Uploaded Successfully" for question in questions: question['user'] = user - file_names = question.pop('files') + file_names = question.pop('files') \ + if 'files' in question \ + else None + tags = question.pop('tags') if 'tags' in question else None test_cases = question.pop('testcase') - tags = question.pop('tags') que, result = Question.objects.get_or_create(**question) if file_names: que._add_files_to_db(file_names, file_path) @@ -935,7 +937,6 @@ class QuestionPaper(models.Model): def create_demo_quiz_ppr(self, demo_quiz, user): question_paper = QuestionPaper.objects.create(quiz=demo_quiz, - total_marks=6.0, shuffle_questions=False ) summaries = ['Roots of quadratic equation', 'Print Output', @@ -951,6 +952,8 @@ class QuestionPaper(models.Model): question_paper.save() # add fixed set of questions to the question paper question_paper.fixed_questions.add(*questions) + question_paper.update_total_marks() + question_paper.save() def get_ordered_questions(self): ques = [] |