diff options
author | Prabhu Ramachandran | 2014-05-18 00:20:14 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2014-05-18 00:20:14 +0530 |
commit | 3d0b69caf6b94a1afe95fef2787929c14afdb485 (patch) | |
tree | 0d58ceacdd7d5f6c6ea1fb2eabc889c552bebdd0 | |
parent | 70b73660f9c10174e318d570a820ca0cc01f8d5f (diff) | |
parent | 4f33c2f53144e6aa101f43947c07cdc7634325a8 (diff) | |
download | online_test-3d0b69caf6b94a1afe95fef2787929c14afdb485.tar.gz online_test-3d0b69caf6b94a1afe95fef2787929c14afdb485.tar.bz2 online_test-3d0b69caf6b94a1afe95fef2787929c14afdb485.zip |
Merge pull request #15 from prathamesh920/load_exam_command
load_exam command modified to accept tags.
-rw-r--r-- | testapp/docs/sample_questions.py | 27 | ||||
-rw-r--r-- | testapp/exam/management/commands/load_exam.py | 4 |
2 files changed, 24 insertions, 7 deletions
diff --git a/testapp/docs/sample_questions.py b/testapp/docs/sample_questions.py index aa7f239..45bb8a8 100644 --- a/testapp/docs/sample_questions.py +++ b/testapp/docs/sample_questions.py @@ -1,7 +1,7 @@ from datetime import date questions = [ -Question( +[Question( summary='Factorial', points=2, type="python", @@ -15,8 +15,11 @@ For example:<br/> assert fact(0) == 1 assert fact(5) == 120 '''), - -Question( +#Add tags here as a list of string. +['Python','function','factorial'], +], + +[Question( summary='Simple function', points=1, type="python", @@ -28,7 +31,11 @@ import math assert sqr(3) == 9 assert abs(sqr(math.sqrt(2)) - 2.0) < 1e-14 '''), -Question( +#Add tags here as a list of string. +['Python','function'], +], + +[Question( summary='Bash addition', points=2, type="bash", @@ -38,7 +45,11 @@ Question( docs/sample.sh docs/sample.args '''), -Question( +#Add tags here as a list of string. +[''], +], + +[Question( summary='Size of integer in Python', points=0.5, type="mcq", @@ -51,7 +62,11 @@ None of the above ''', test = "No Limit" ), -] +#Add tags here as a list of string. +['mcq'], +], + +] #list of questions ends here quiz = Quiz(start_date=date.today(), duration=10, diff --git a/testapp/exam/management/commands/load_exam.py b/testapp/exam/management/commands/load_exam.py index 3f247a1..e3f72da 100644 --- a/testapp/exam/management/commands/load_exam.py +++ b/testapp/exam/management/commands/load_exam.py @@ -32,7 +32,9 @@ def load_exam(filename): raise NameError(msg) for question in questions: - question.save() + question[0].save() + for tag in question[1]: + question[0].tags.add(tag) if 'quiz' in locals(): quiz.save() |