# HG changeset patch # User nishanth # Date 1271857667 -19800 # Node ID d28d0957a5abdf07c4c26841346d7e6c728297a5 # Parent 5e1f3c46ef7f955d8bfe09e72fd3cc9f06cac800 added intro page and manual submit button in question page diff -r 5e1f3c46ef7f -r d28d0957a5ab question_bank.xml --- a/question_bank.xml Wed Apr 21 13:21:13 2010 +0530 +++ b/question_bank.xml Wed Apr 21 19:17:47 2010 +0530 @@ -1,91 +1,59 @@ - - - - - How will you set the x and y axis limits so that the region of interest is in the rectangle $(0, -1.5)$ (left bottom coordinate) and $(2\pi, 1.5)$ (right top coordinate)? - - - 30 - - - xlim\( 0 , 2 \* pi \) [;,\n+] ylim\( -1.5 , 1.5\) - - + - - - If a = [1, 2, 5, 9] then what is the value of a[0:-1]? - - - 30 - - - \[ 1 , 2 , 5 \] - - + + +How will you set the x and y axis limits so that the region of interest is in the rectangle (0, -1.5) and (2\pi, 1.5)? + + +30 + + +xlim \( 0 , 2 \* pi \) [;,\n+] ylim \( -1.5 , 1.5\) + + - - - A sample line from a Comma Separated Values (CSV) file: - line = "Rossum, Guido, 42, 56, 34, 54" - What code would you use to separate the line into fields? - - - 30 - - - (line\.split\( ([",']) , \2 \)) - - + + +If a = [1, 2, 5, 9] then what is the value of a[0:-1] + + +30 + + +\[ 1 , 2 , 5 \] + + - - - If a = [1, 2, 5, 9] how do you find the length of this list? - - - 30 - - - len\( a \) - - - - - What is the maximum number that can be represented natively in Python. - - - 15 - - - Infinite - 2**32 - - - Infinite - - + + +A sample line from a Comma Separated Values (CSV) file: +line = "Rossum, Guido, 42, 56, 34, 54" +What code would you use to separate the line into fields? + + +30 + + +(line\.split \( ([",']) , \2 \)) + + - - - There is a bug in this code. What is the bug. - - - 30 - - -for i in range(5): - plot(i,sin(i)) + + +If a = [1, 2, 5, 9] how do you find the length of this list? + + +30 + + +len \( a \) + + - - - plot(i,sin(i)) - - - - + - + diff -r 5e1f3c46ef7f -r d28d0957a5ab quiz/views.py --- a/quiz/views.py Wed Apr 21 13:21:13 2010 +0530 +++ b/quiz/views.py Wed Apr 21 19:17:47 2010 +0530 @@ -102,7 +102,29 @@ new_quiz.que_remaining = "|".join(available_que_ids) new_quiz.save() - return redirect("/quiz/answer/%s"%(new_quiz.key)) + return redirect("/quiz/intro/%s"%(new_quiz.key)) + +def quiz_intro(request, quiz_key): + """ simply give intro to user + if there are questions redirect. + else raise Http404 + """ + + user = request.user + + try: + event = Event.objects.all()[0] + except IndexError: + raise Http404 + + if event.quiz_status == "00": + raise Http404 + + try: + old_quiz = Quiz.objects.get(event=event,user=user, quiz_num=event.quiz_status) + return render_to_response("quiz_intro.html", {"user":user, "quiz":old_quiz}) + except Quiz.DoesNotExist: + raise Http404 def answer(request, quiz_key): """ see if username and quiz give a proper quiz object diff -r 5e1f3c46ef7f -r d28d0957a5ab templates/display_question.html --- a/templates/display_question.html Wed Apr 21 13:21:13 2010 +0530 +++ b/templates/display_question.html Wed Apr 21 19:17:47 2010 +0530 @@ -36,6 +36,7 @@ {% else %}
{% endif %} - + + {% endblock %} diff -r 5e1f3c46ef7f -r d28d0957a5ab templates/quiz_intro.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/quiz_intro.html Wed Apr 21 19:17:47 2010 +0530 @@ -0,0 +1,44 @@ +{% extends 'base.html' %} +{% block script %} + +{% endblock %} +{% block content %} +Welcome {{user.get_full_name}}
+
+