From b1fbf5b02280de5b78b0249e777a179e34b50b98 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Fri, 24 Feb 2012 16:16:38 +0530 Subject: formating and identation --- testapp/exam/forms.py | 7 ++ testapp/exam/views.py | 16 ++- testapp/templates/base.html | 135 +++++++++++---------- testapp/templates/exam/add_question.html | 32 +++-- testapp/templates/exam/add_quiz.html | 36 +++--- testapp/templates/exam/complete.html | 37 +++--- testapp/templates/exam/edit_question.html | 38 +++--- testapp/templates/exam/edit_quiz.html | 43 ++++--- testapp/templates/exam/grade_user.html | 4 +- testapp/templates/exam/intro.html | 103 ++++++---------- testapp/templates/exam/login.html | 76 ++++++------ testapp/templates/exam/monitor.html | 53 ++++----- testapp/templates/exam/question.html | 190 ++++++++++++++---------------- testapp/templates/exam/quit.html | 39 +++--- testapp/templates/exam/register.html | 46 ++++---- testapp/templates/exam/show_quiz.html | 39 +++--- testapp/templates/exam/showquestions.html | 40 +++---- testapp/templates/exam/user_data.html | 6 +- testapp/templates/manage.html | 61 +++++----- 19 files changed, 467 insertions(+), 534 deletions(-) diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py index 1788a08..e622b88 100644 --- a/testapp/exam/forms.py +++ b/testapp/exam/forms.py @@ -18,6 +18,7 @@ UNAME_CHARS = letters + "._" + digits PWD_CHARS = letters + punctuation + digits class UserRegisterForm(forms.Form): + """A Class to create new form for User's Registration. It has the various fields and functions required to register a new user to the system""" username = forms.CharField(max_length=30, help_text='Letters, digits, period and underscores only.') @@ -88,6 +89,8 @@ class UserRegisterForm(forms.Form): return u_name, pwd class UserLoginForm(forms.Form): + """Creates a form which will allow the user to log into the system.""" + username = forms.CharField(max_length = 30) password = forms.CharField(max_length=30, widget=forms.PasswordInput()) @@ -105,6 +108,8 @@ class UserLoginForm(forms.Form): return user class QuizForm(forms.Form): + """Creates a form to add or edit a Quiz. It has the related fields and functions required.""" + start_date = forms.DateField(initial=datetime.date.today) duration = forms.IntegerField() active = forms.BooleanField(required = False) @@ -124,6 +129,8 @@ class QuizForm(forms.Form): new_quiz.save() class QuestionForm(forms.Form): + """Creates a form to add or edit a Question. It has the related fields and functions required.""" + summary = forms.CharField(max_length = 128) description = forms.CharField(widget = forms.Textarea(attrs={'cols': 20, 'rows': 3})) points = forms.FloatField() diff --git a/testapp/exam/views.py b/testapp/exam/views.py index 6eea338..2803538 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -93,6 +93,8 @@ def user_register(request): context_instance=RequestContext(request)) def edit_quiz(request): + """Edit the list of quizzes seleted by the user for editing.""" + user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0 : raise Http404('You are not allowed to view this page!') @@ -114,6 +116,7 @@ def edit_quiz(request): return my_redirect("/exam/manage/showquiz/") def edit_question(request): + """Edit the list of quizzes seleted by the user for editing.""" user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0 : raise Http404('You are not allowed to view this page!') @@ -142,6 +145,7 @@ def edit_question(request): def add_question(request,question_id=None): """To add a new question in the database. Create a new question and store it.""" + user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0 : raise Http404('You are not allowed to view this page!') @@ -192,6 +196,8 @@ def add_question(request,question_id=None): def add_quiz(request,quiz_id=None): + """To add a new quiz in the database. Create a new question and store it.""" + user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0 : raise Http404('You are not allowed to view this page!') @@ -237,6 +243,7 @@ def add_quiz(request,quiz_id=None): def prof_manage(request): """Take credentials of the user with professor/moderator rights/permissions and log in.""" + user = request.user if user.is_authenticated() and user.groups.filter(name='moderator').count() > 0: return render_to_response('manage.html',{}) @@ -340,6 +347,7 @@ def question(request, q_id): def show_question(request, q_id): """Show a question if possible.""" + if len(q_id) == 0: msg = 'Congratulations! You have successfully completed the quiz.' return complete(request, msg) @@ -347,7 +355,7 @@ def show_question(request, q_id): return question(request, q_id) def check(request, q_id): - + """Checks the answers of the user for particular question""" user = request.user if not user.is_authenticated(): @@ -432,8 +440,8 @@ def complete(request,reason = None): return my_redirect('/exam/') def monitor(request, quiz_id=None): - """Monitor the progress of the papers taken so far.""" + user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0: raise Http404('You are not allowed to view this page!') @@ -479,6 +487,7 @@ def get_user_data(username): def show_all_users(request): """Shows all the users who have taken various exams/quiz.""" + user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0: raise Http404('You are not allowed to view this page !') @@ -489,6 +498,7 @@ def show_all_users(request): def show_all_quiz(request): """Generates a list of all the quizzes that are currently in the database.""" + user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0: raise Http404('You are not allowed to view this page !') @@ -548,6 +558,7 @@ def show_all_quiz(request): def show_all_questions(request): """Show a list of all the questions currently in the databse.""" + user = request.user if not user.is_authenticated() or user.groups.filter(name='moderator').count() == 0 : raise Http404("You are not allowed to view this page !") @@ -608,6 +619,7 @@ def show_all_questions(request): def user_data(request, username): """Render user data.""" + current_user = request.user if not current_user.is_authenticated() or current_user.groups.filter(name='moderator').count() == 0: raise Http404('You are not allowed to view this page!') diff --git a/testapp/templates/base.html b/testapp/templates/base.html index 54a2035..49fc7ce 100644 --- a/testapp/templates/base.html +++ b/testapp/templates/base.html @@ -2,84 +2,83 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + + + {% block title %} + {% endblock %} + - -{% block title %} -{% endblock %} - + {% block meta %} + + + + {% endblock %} -{% block meta %} - - - -{% endblock %} - - - -{% block css %} - + {% endblock %} - .content .span10, - .content .span14 { - min-height: 500px; - } - - .content .span4 { - margin-left: 0; - padding-left: 19px; - border-left: 1px solid #eee; - } - - .topbar .btn { - border: 0; - } - - -{% endblock %} - -{% block script %} -{% endblock %} - + {% block script %} + {% endblock %} +
-{% block content %} -{% endblock %} + {% block content %} + {% endblock %}
- diff --git a/testapp/templates/exam/add_question.html b/testapp/templates/exam/add_question.html index 2d42b34..d5503b5 100644 --- a/testapp/templates/exam/add_question.html +++ b/testapp/templates/exam/add_question.html @@ -1,27 +1,25 @@ {% extends "manage.html" %} -{% block subtitle %} -Add Question -{% endblock %} +{% block subtitle %}Add Question{% endblock %} {% block manage %} - +
-{% csrf_token %} -
-{{ form.as_table }} -
-
-
+ {% csrf_token %} +
+ {{ form.as_table }} +
+
+
{% endblock %} diff --git a/testapp/templates/exam/add_quiz.html b/testapp/templates/exam/add_quiz.html index d51d129..4dae30b 100644 --- a/testapp/templates/exam/add_quiz.html +++ b/testapp/templates/exam/add_quiz.html @@ -1,28 +1,26 @@ {% extends "manage.html" %} -{% block subtitle %} -Add Quiz -{% endblock %} +{% block subtitle %}Add Quiz{% endblock %} {% block manage %} + -
-{% csrf_token %} -
- -{{ form.as_table }} -
-
-
-
+ {% csrf_token %} +
+ + {{ form.as_table }} +
+
+
+
{% endblock %} diff --git a/testapp/templates/exam/complete.html b/testapp/templates/exam/complete.html index 6a401a4..f5c658f 100644 --- a/testapp/templates/exam/complete.html +++ b/testapp/templates/exam/complete.html @@ -3,26 +3,21 @@ {% block title %}Good bye!{% endblock %} {% block content %} - - -
-
- -
-
- -

Good bye!

- -

{{message}}

- -

You may now close the browser.

- -
-
-

© FOSSEE group, IIT Bombay

-
+
+
+ +
+
+

Good bye!

+

{{message}}

+

You may now close the browser.

+
+
+
+
+

© FOSSEE group, IIT Bombay

+
- {% endblock content %} diff --git a/testapp/templates/exam/edit_question.html b/testapp/templates/exam/edit_question.html index 04217ab..7613cc6 100644 --- a/testapp/templates/exam/edit_question.html +++ b/testapp/templates/exam/edit_question.html @@ -1,29 +1,27 @@ {% extends "manage.html" %} -{% block subtitle %} -Edit Question -{% endblock %} +{% block subtitle %}Edit Question{% endblock %} {% block manage %} - +
-{% csrf_token %} -{% for form in forms %} - -{{ form.as_table }} -
-
-{% endfor %} -
-
+ {% csrf_token %} + {% for form in forms %} + + {{ form.as_table }} +
+
+ {% endfor %} +
+
{% endblock %} diff --git a/testapp/templates/exam/edit_quiz.html b/testapp/templates/exam/edit_quiz.html index 7744623..27b179f 100644 --- a/testapp/templates/exam/edit_quiz.html +++ b/testapp/templates/exam/edit_quiz.html @@ -1,31 +1,28 @@ {% extends "manage.html" %} -{% block subtitle %} -Edit Quiz(zes) -{% endblock %} +{% block subtitle %}Edit Quiz(zes){% endblock %} {% block manage %} - - +
-{% csrf_token %} -{% for form in forms %} -
- -{{ form.as_table }} -
-
-
-{% endfor %} -
-
+ {% csrf_token %} + {% for form in forms %} +
+ + {{ form.as_table }} +
+
+
+ {% endfor %} +
+
{% endblock %} diff --git a/testapp/templates/exam/grade_user.html b/testapp/templates/exam/grade_user.html index bad1765..5b0e1a7 100644 --- a/testapp/templates/exam/grade_user.html +++ b/testapp/templates/exam/grade_user.html @@ -71,8 +71,7 @@ Marks: 1 %} - - Monitor quiz +Monitor quiz {% else %} {% with data.papers.0 as paper %} @@ -81,5 +80,4 @@ Marks: Admin - {% endblock%} diff --git a/testapp/templates/exam/intro.html b/testapp/templates/exam/intro.html index 35a6923..167a4b2 100644 --- a/testapp/templates/exam/intro.html +++ b/testapp/templates/exam/intro.html @@ -3,68 +3,43 @@ {% block title %}Instructions and Rules {% endblock %} {% block content %} - -
-
- -
-
-

Important instructions & rules


- -

Welcome {{user.first_name.title}} {{user.last_name.title}}, -to the programming quiz!

- -

-This examination system has been developed with the intention of making you -learn programming and be assessed in an interactive and fun manner. -You will be presented with a series of programming questions and problems that -you will answer online and get immediate feedback for. -

- -

Here are some important instructions and rules that you should understand -carefully. -

- -
    - -
  • For any programming questions, you can submit solutions as many times as - you want without a penalty. You may skip questions and solve them later. -
  • - -
  • You may use your computer's Python/IPython shell or - an editor to solve - the problem and cut/paste the solution to the web interface. -
  • - -
  • You are not allowed to use any internet - resources, i.e. no google etc.
  • - -
  • Do not copy or share the questions or answers with anyone until the - exam is complete for everyone.
  • - -
  • All your attempts at the questions are logged. - Do not try to outsmart and break the testing system. If you do, we know - who you are and we will expell you from the course. You have been warned. -
  • - -
- -

We hope you enjoy taking this exam !!!

- -
-{% csrf_token %} -
- -
-
-
-
-
-

© FOSSEE group, IIT Bombay

-
- -
- +
+
+ +
+
+

Important instructions & rules


+

Welcome {{user.first_name.title}} {{user.last_name.title}}, to the programming quiz!

+

+ This examination system has been developed with the intention of making you + learn programming and be assessed in an interactive and fun manner. + You will be presented with a series of programming questions and problems that + you will answer online and get immediate feedback for. +

+

Here are some important instructions and rules that you should understand carefully.

+
    +
  • For any programming questions, you can submit solutions as many times as you want without a penalty. You may skip questions and solve them later. +
  • +
  • You may use your computer's Python/IPython shell or an editor to solve the problem and cut/paste the solution to the web interface. +
  • +
  • You are not allowed to use any internet resources, i.e. no google etc.
  • +
  • Do not copy or share the questions or answers with anyone until the exam is complete for everyone.
  • +
  • All your attempts at the questions are logged. Do not try to outsmart and break the testing system. If you do, we know who you are and we will expell you from the course. You have been warned. +
  • +
+

We hope you enjoy taking this exam !!!

+ +
+ {% csrf_token %} +
+
+
+
+
+
+

© FOSSEE group, IIT Bombay

+
+
{% endblock content %} diff --git a/testapp/templates/exam/login.html b/testapp/templates/exam/login.html index 62aedcf..07a91fc 100644 --- a/testapp/templates/exam/login.html +++ b/testapp/templates/exam/login.html @@ -3,46 +3,40 @@ {% block title %}Login{% endblock title %} {% block content %} - -
-
- -
-
-

Login


-
-{% csrf_token %} - - -
-{{ form.as_table }} -
- -
    
-
Forgot Password?

-
New User? Sign-Up
-
+
+
+ +
+
+

Login


+
+ {% csrf_token %} + +
+ {{ form.as_table }} +
+
    
+
Forgot Password?

+
New User? Sign-Up
+
+
+
+
+
+

© FOSSEE group, IIT Bombay

+
-
-
-
-

© FOSSEE group, IIT Bombay

-
- -
- - {% endblock content %} diff --git a/testapp/templates/exam/monitor.html b/testapp/templates/exam/monitor.html index 60814c7..a0287e7 100644 --- a/testapp/templates/exam/monitor.html +++ b/testapp/templates/exam/monitor.html @@ -6,18 +6,15 @@ {% block manage %} -{% if not quizzes and not quiz %} -

Quiz results

- -
No quizzes available.
- -{% endif %} + {% if not quizzes and not quiz %} +

Quiz results

+
No quizzes available.
+ {% endif %} {# ############################################################### #} {# This is rendered when we are just viewing exam/monitor #} {% if quizzes %}

Available quizzes

-
    {% for quiz in quizzes %}
  • {{ quiz.description }}
  • @@ -33,32 +30,32 @@ {% if papers %} {#

    Quiz: {{ quiz_name }}

    #}

    Number of papers: {{ papers|length }}

    - + - - - - - - - + + + + + + + {% for paper in papers %} - - + + diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html index a02e8c4..113a9ae 100644 --- a/testapp/templates/exam/question.html +++ b/testapp/templates/exam/question.html @@ -1,117 +1,103 @@ {% extends "base.html" %} + - {% block title %} Answer question {% endblock %} +{% block title %} Answer question {% endblock %} {% block script %} - + {% endblock script %} {% block onload %} onload="update_time()" {% endblock onload %} {% block content %} -
    -
    -
    -

    Online Test

    - - -
    - {% csrf_token %} - - -
    -
    -
    +
    +
    +

    Online Test

    +
    + {% csrf_token %} + + +
    +
    +
    -
    - -
    -
    - -

    {{ question.summary }}

    -
    {{ question.description|safe }}
    -
    (Marks : {{ question.points }})
    - - -{% if error_message %}
    ERROR:
    {{ error_message }}
    {% endif %} - -

    - -
    -{% csrf_token %} -{% if question.type == "mcq" %} -{% for option in question.options.strip.splitlines %} -{{option}}
    -{% endfor %} -{% else %} - -{% endif %} - -{% if question.type == "mcq" %} -
       - -{% else %} -   - -{% endif %} - - - - -
    {{ user.first_name.title }} {{ user.last_name.title }}, You have {{ paper.questions_left }} question(s) left in {{ quiz_name }}
    - -

    Time left:

    - -
    - -
    -
    -

    © FOSSEE group, IIT Bombay

    -
    +
    + +
    +
    +

    {{ question.summary }}

    +
    {{ question.description|safe }}
    +
    (Marks : {{ question.points }})
    + {% if error_message %}
    ERROR:
    {{ error_message }}
    {% endif %} +

    +
    + {% csrf_token %} + {% if question.type == "mcq" %} + {% for option in question.options.strip.splitlines %} + {{option}}
    + {% endfor %} + {% else %} + + {% endif %} + + {% if question.type == "mcq" %} +
       + {% else %} +    + {% endif %} + + +
    {{ user.first_name.title }} {{ user.last_name.title }}, You have {{ paper.questions_left }} question(s) left in {{ quiz_name }}
    +

    Time left:

    +
    +
    +
    +
    +
    +

    © FOSSEE group, IIT Bombay

    +
    - {% endblock content %} diff --git a/testapp/templates/exam/quit.html b/testapp/templates/exam/quit.html index 3ee85db..118ea07 100644 --- a/testapp/templates/exam/quit.html +++ b/testapp/templates/exam/quit.html @@ -2,28 +2,25 @@ {% block title %}Quit exam {% endblock %} - - {% block content %} -
    -
    - -
    -
    -

    Your current answers are saved.

    -

    Are you sure you wish to quit the exam?

    -
    - {% csrf_token %} -
     
    - -
    -
    -
    -
    -

    © FOSSEE group, IIT Bombay

    -
    +
    + +
    +
    +

    Your current answers are saved.

    +

    Are you sure you wish to quit the exam?

    +
    + {% csrf_token %} +
     
    + +
    +
    +
    +
    +

    © FOSSEE group, IIT Bombay

    +
    {% endblock content %} diff --git a/testapp/templates/exam/register.html b/testapp/templates/exam/register.html index 1555ab3..e416470 100644 --- a/testapp/templates/exam/register.html +++ b/testapp/templates/exam/register.html @@ -3,32 +3,26 @@ {% block title %}Registration form {% endblock %} {% block content %} - -
    -
    - -
    -
    +
    +
    + +
    +

    Please fill in the following details


    - -
    -{% csrf_token %} -
    Name Username Roll number Institute Questions answered Total marks Attempts Name Username Roll number Institute Questions answered Total marks Attempts
    - {{ paper.user.get_full_name.title }} - {{ paper.user.username }} {{ paper.user.get_full_name.title }} {{ paper.user.username }} {{ paper.profile.roll_number }} {{ paper.profile.institute }} {{ paper.get_answered_str }}
    -{{ form.as_table }} -
-
  
- +
+ {% csrf_token %} +
+ {{ form.as_table }} +
+
  
+
+ + + +
+

© FOSSEE group, IIT Bombay

+
- - - -
-

© FOSSEE group, IIT Bombay

-
- - - - {% endblock content %} diff --git a/testapp/templates/exam/show_quiz.html b/testapp/templates/exam/show_quiz.html index d546b06..e6aecd6 100644 --- a/testapp/templates/exam/show_quiz.html +++ b/testapp/templates/exam/show_quiz.html @@ -3,33 +3,31 @@ {% block title %} Quiz List {% endblock title %} {% block script %} - + } + {% endblock %} {% block manage %} @@ -46,13 +44,14 @@ function confirm_edit(frm) {% csrf_token %} {% for quiz in quizzes %} -   {{ quiz.description }}
{% endfor %} +

      {% endif %} + {% endblock %} diff --git a/testapp/templates/exam/showquestions.html b/testapp/templates/exam/showquestions.html index edcba6f..116e747 100644 --- a/testapp/templates/exam/showquestions.html +++ b/testapp/templates/exam/showquestions.html @@ -1,37 +1,34 @@ {% extends "manage.html" %} -{% block subtitle %} -List of Questions -{% endblock %} +{% block subtitle %}List of Questions {% endblock %} {% block script %} - + } + {% endblock %} {% block manage %} @@ -44,6 +41,5 @@ function confirm_edit(frm)       - {% endblock %} diff --git a/testapp/templates/exam/user_data.html b/testapp/templates/exam/user_data.html index 943dfe8..fad0310 100644 --- a/testapp/templates/exam/user_data.html +++ b/testapp/templates/exam/user_data.html @@ -70,12 +70,10 @@ User IP address: {{ paper.user_ip }} Grade/correct paper
{% if data.papers.count > 1 %} - - Monitor quiz +Monitor quiz {% else %} {% with data.papers.0 as paper %} - - Monitor quiz +Monitor quiz {% endwith %} {% endif %} diff --git a/testapp/templates/manage.html b/testapp/templates/manage.html index 10842c3..a2941b0 100644 --- a/testapp/templates/manage.html +++ b/testapp/templates/manage.html @@ -3,47 +3,42 @@ {% block title %}Manage{% endblock title %} {% block content %} -
-
-

{% block subtitle %} {% endblock %}


- {% block manage %} - {% endblock %} -
- - -
-
Manage
- -
+ } + +
+
Manage
+ +
-
-
-

© FOSSEE group, IIT Bombay

-
- -
- - + +
+

© FOSSEE group, IIT Bombay

+
+ {% endblock content %} -- cgit