diff options
-rw-r--r-- | yaksh/models.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 787daa6..9603282 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) |