# HG changeset patch # User nishanth # Date 1271832079 -19800 # Node ID ea1c0110e989a0a349137a60df0e48dae6d3098b # Parent 456b7b9e3d1375fcf424cb8e3f02e1620e6be763 fixed the display of question diff -r 456b7b9e3d13 -r ea1c0110e989 question_bank.xml --- a/question_bank.xml Wed Apr 21 11:08:44 2010 +0530 +++ b/question_bank.xml Wed Apr 21 12:11:19 2010 +0530 @@ -50,25 +50,42 @@ len\( a \) - - - - What is the maximum number that can be represented natively in Python. - 30 + 15 Infinite 2**32 - 1 + Infinite - + + + + There is a bug in this code. What is the bug. + + + 30 + + +for i in range(5): + plot(i,sin(i)) + + + + plot(i,sin(i)) + + + + + + + diff -r 456b7b9e3d13 -r ea1c0110e989 quiz/management/commands/seed_db.py --- a/quiz/management/commands/seed_db.py Wed Apr 21 11:08:44 2010 +0530 +++ b/quiz/management/commands/seed_db.py Wed Apr 21 12:11:19 2010 +0530 @@ -13,28 +13,6 @@ ev.stop_date = datetime.now() ev.quiz_status = '11' ev.save() - - q1 = QuestionBank() - q1.quiz_num = "11" - q1.description = "How do you combine two lists a and b" - q1.time_limit = 15 - q1.expected_ans = r"a + b" - q1.save() - - q2 = QuestionBank() - q2.quiz_num = '11' - q2.description = "What IPython magic command would you use to obtain the code that you have already typed." - q2.time_limit = 15 - q2.expected_ans = r"%hist" - q2.save() - - q3 = QuestionBank() - q3.quiz_num = "11" - q3.description = "a = [1, 2, 5, 9]. How do you add 10 to end of this list." - q3.time_limit = 30 - q3.expected_ans = r"a.append(10)" - q3.save() - class Command(NoArgsCommand): diff -r 456b7b9e3d13 -r ea1c0110e989 quiz/views.py --- a/quiz/views.py Wed Apr 21 11:08:44 2010 +0530 +++ b/quiz/views.py Wed Apr 21 12:11:19 2010 +0530 @@ -153,7 +153,8 @@ else: return redirect('/quiz/answer/%s'%quiz.key) else: - return render_to_response('display_question.html', {'question':question}) + options = [ _.strip() for _ in question.options.split('\n') ] if question.options else [] + return render_to_response('display_question.html', {'question':question, 'options':options}) def quiz_complete(request): """ display thanq and log the user out. diff -r 456b7b9e3d13 -r ea1c0110e989 templates/display_question.html --- a/templates/display_question.html Wed Apr 21 11:08:44 2010 +0530 +++ b/templates/display_question.html Wed Apr 21 12:11:19 2010 +0530 @@ -19,14 +19,23 @@ {% endblock %} {% block content %} -{{question.description}}
+{{question.description|linebreaksbr}}
{% if question.code %} -
Code -
{{question.code}}
+
+
{{question.code}}
{% endif %} - +
+Answer:
-
+ {% if options %} + {% for option in options %} + {{option}}
+ {% endfor %} +
+ +{% else %} +
+{% endif %}
{% endblock %}