summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaheshgudi2017-10-03 16:41:52 +0530
committermaheshgudi2017-10-06 12:35:42 +0530
commitdb66f70b447c0d32495c9c97736f09a180560c49 (patch)
tree1c149dae0fe45b6713b6fa1d795beb2fba458090
parenta626f3792d03ccd96a1c49c7096076950d020c5a (diff)
downloadonline_test-db66f70b447c0d32495c9c97736f09a180560c49.tar.gz
online_test-db66f70b447c0d32495c9c97736f09a180560c49.tar.bz2
online_test-db66f70b447c0d32495c9c97736f09a180560c49.zip
Allow file field and tags field to be skipped altogether in an yaml file
-rw-r--r--yaksh/models.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 4859d3e..5747f13 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -419,9 +419,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)