diff options
author | Prabhu Ramachandran | 2017-10-17 22:50:36 +0530 |
---|---|---|
committer | GitHub | 2017-10-17 22:50:36 +0530 |
commit | 4e7d09eae252c6d89d2fecfe18ffce46e4421eb0 (patch) | |
tree | 13586b1dfd8003cef645c99e2cb3801835496674 /yaksh/models.py | |
parent | 2ab25fcf914215e00fcfd6196576444c1a75c808 (diff) | |
parent | 1ad1ef1c69cb8208e4d330a9695442b4d78134ac (diff) | |
download | online_test-4e7d09eae252c6d89d2fecfe18ffce46e4421eb0.tar.gz online_test-4e7d09eae252c6d89d2fecfe18ffce46e4421eb0.tar.bz2 online_test-4e7d09eae252c6d89d2fecfe18ffce46e4421eb0.zip |
Merge pull request #351 from maheshgudi/yaml_fixes
Yaml fixes
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 787daa6..f7d9906 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) @@ -923,7 +925,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', @@ -939,6 +940,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 = [] |