]> git.parisson.com Git - django_quiz.git/commitdiff
moved templates around, fiddled with a few, some changes to template tags and tests
authorTom Walker <tomwalker0472@gmail.com>
Wed, 25 Jun 2014 21:40:19 +0000 (22:40 +0100)
committerTom Walker <tomwalker0472@gmail.com>
Wed, 25 Jun 2014 21:40:19 +0000 (22:40 +0100)
29 files changed:
multichoice/templates/answers_for_mc_question.html [new file with mode: 0644]
quiz/admin.py
quiz/templates/base.html [new file with mode: 0644]
quiz/templates/correct_answer.html [new file with mode: 0644]
quiz/templates/list_categories.html [new file with mode: 0644]
quiz/templates/progress.html [new file with mode: 0644]
quiz/templates/question.html [new file with mode: 0644]
quiz/templates/quiz_index.html [new file with mode: 0644]
quiz/templates/result.html [new file with mode: 0644]
quiz/templates/signup.html [new file with mode: 0644]
quiz/templates/user_previous_exam.html [new file with mode: 0644]
quiz/templates/view_quiz_category.html [new file with mode: 0644]
quiz/templatetags/quiz_tags.py
quiz/tests.py
quiz/views.py
templates/quiz/answers_for_mc_question.html [deleted file]
templates/quiz/answers_for_question.html [deleted file]
templates/quiz/answers_for_tf_question.html [deleted file]
templates/quiz/base.html [deleted file]
templates/quiz/correct_answer.html [deleted file]
templates/quiz/list_categories.html [deleted file]
templates/quiz/progress.html [deleted file]
templates/quiz/question.html [deleted file]
templates/quiz/quiz_index.html [deleted file]
templates/quiz/result.html [deleted file]
templates/quiz/signup.html [deleted file]
templates/quiz/user_previous_exam.html [deleted file]
templates/quiz/view_quiz_category.html [deleted file]
true_false/templates/answers_for_tf_question.html [new file with mode: 0644]

diff --git a/multichoice/templates/answers_for_mc_question.html b/multichoice/templates/answers_for_mc_question.html
new file mode 100644 (file)
index 0000000..0a06931
--- /dev/null
@@ -0,0 +1,10 @@
+{% for answer in answers %}
+<tr>
+  <td>
+       <label>
+         <input type="radio" name="guess" value="{{ answer.id }}" class="form-radio">
+         {{ answer.content }}
+       </label>
+  </td>
+</tr>
+{% endfor %}
index 97ebe7ba7bfa2c444231b711b0047fa2f3fc709c..914b77d4ae8f4854d8880441296c3a0cb9db44f6 100644 (file)
@@ -44,6 +44,7 @@ class QuizAdminForm(forms.ModelForm):
             self.save_m2m()
         return quiz
 
+
 class QuizAdmin(admin.ModelAdmin):
     form = QuizAdminForm
 
@@ -52,7 +53,6 @@ class QuizAdmin(admin.ModelAdmin):
     search_fields = ('description', 'category', )
 
 
-
 class CategoryAdmin(admin.ModelAdmin):
     search_fields = ('category', )
 
diff --git a/quiz/templates/base.html b/quiz/templates/base.html
new file mode 100644 (file)
index 0000000..de93368
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
+<head>
+<meta charset="utf-8">
+
+<title>Example Quiz Website | {% block title %}{% endblock %}</title>
+<meta name="description" content="{% block description %}{% endblock %}">
+
+<!-- styles -->
+<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
+
+<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
+<!--[if lt IE 9]>
+<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
+<![endif]-->
+
+</head>
+
+<body>
+
+
+<!-- Before the quiz content -->
+
+{% block content %}
+
+{% endblock %}
+
+<!-- After the quiz content -->
+
+
+</body>
+</html>
diff --git a/quiz/templates/correct_answer.html b/quiz/templates/correct_answer.html
new file mode 100644 (file)
index 0000000..1edf214
--- /dev/null
@@ -0,0 +1,42 @@
+
+{% if user_was_incorrect %}
+
+       <div class="alert alert-warning">
+
+               <strong>You answered the above question incorrectly</strong>
+
+       </div>
+
+{% else %}
+
+       <div class="alert alert-success">
+
+               <strong>You answered the above question correctly</strong>
+
+       </div>
+
+{% endif %}
+
+<table class="table table-striped table-bordered">
+  <tbody>
+
+       {% for answer in answers %}
+
+      {% if answer.correct %}
+
+           <tr class="success">
+                 <td>{{ answer.content }}</td>
+                 <td><strong>This is the correct answer</strong></td>
+
+      {% else %}
+               <tr>
+         <td>{{ answer.content }}</td>
+                 <td></td>
+
+         {% endif %}
+           </tr>
+
+       {% endfor %}
+
+  </tbody>
+</table>
diff --git a/quiz/templates/list_categories.html b/quiz/templates/list_categories.html
new file mode 100644 (file)
index 0000000..1ae019b
--- /dev/null
@@ -0,0 +1,21 @@
+{% extends 'base.html' %}
+{% block title %}All Quizzes{% endblock %}
+
+{% block content %}
+<h2>Category list</h2>
+
+<ul>
+  {% for cat in categories %}
+  <li>
+       <a href="{% url 'quiz.views.view_category' slug=cat.category %}">
+         {{ cat.category }}
+       </a>
+  </li>
+  {% endfor %}
+</ul>
+
+{% endblock %}
+
+{% block right-sidebar %}
+<h2>Sponsored Advertisements</h2>
+{% endblock %}
diff --git a/quiz/templates/progress.html b/quiz/templates/progress.html
new file mode 100644 (file)
index 0000000..32c6902
--- /dev/null
@@ -0,0 +1,154 @@
+{% extends "base.html" %}
+
+{% load quiz_tags %}
+
+{% block title %} Progress Page {% endblock %}
+{% block description %} User Progress Page {% endblock %}
+
+{% block content %}
+
+<div class="container">
+
+{% if new_user %}
+
+               <div class="alert alert-block">
+                       <button type="button" class="close" data-dismiss="alert">&times;</button>
+                       <ul class="unstyled">
+                       <li>
+                               <h4>Thank you for joining this website. Welcome to your progress page.</h4>
+                       </li>
+               </ul>
+               </div>
+
+{% endif %}
+
+
+{% if cat_scores %}
+
+<h1>Question Category Scores</h1>
+<p class="lead">
+       Below are the categories of questions that you have attempted. Blue is the percentage that are correct.
+</p>
+
+<script type="text/javascript" src="http://www.google.com/jsapi"></script>
+<script type="text/javascript">
+       google.load('visualization', '1', {packages: ['corechart']});
+</script>
+
+               {% for cat, value in cat_scores.items %}
+
+                       {% ifnotequal cat "empty" %}
+
+                               {% if forloop.first %}
+                                       <div class="row">
+                                               <ul class="thumbnails">
+                               {% endif %}
+
+                               {% ifequal forloop.counter 5 %}
+                                               </ul>
+                                       </div>
+                                       <div class="row">
+                                               <ul class="thumbnails">
+                               {% endifequal %}
+
+                               {% ifequal forloop.counter 9 %}
+                                               </ul>
+                                       </div>
+                                       <div class="row">
+                                               <ul class="thumbnails">
+                               {% endifequal %}
+
+                               {% ifequal forloop.counter 13 %}
+                                               </ul>
+                                       </div>
+                                       <div class="row">
+                                               <ul class="thumbnails">
+                               {% endifequal %}
+
+                               {% ifequal forloop.counter 17 %}
+                                               </ul>
+                                       </div>
+                                       <div class="row">
+                                               <ul class="thumbnails">
+                               {% endifequal %}
+
+                                                       <li class="span3">
+                                                               <div class="thumbnail">
+                                                                                                                           <script type="text/javascript">
+                                                     function drawVisualization() {
+                                                       // Create and populate the data table.
+                                                       var difference = {{ value.1 }} - {{ value.0 }};
+                                                       var correct = {{ value.0 }};
+                                                       var data = google.visualization.arrayToDataTable([
+                                                         ["",""],
+                                                         ['Correct',  correct],
+                                                         ['Incorrect', difference]
+                                                       ]);
+
+                                                       var options = {
+                                                               legend:{position:'none'},
+                                                               title:"{{ cat }}",
+                                                               fontSize: 16
+                                                               };
+
+                                                       // Create and draw the visualization.
+                                                       new google.visualization.PieChart(document.getElementById('visualization{{ cat }}')).
+                                                           draw(data, options);
+                                                     }
+
+
+                                                     google.setOnLoadCallback(drawVisualization);
+                                                   </script>
+
+                                               <div id="visualization{{ cat }}" ></div>
+                                                               </div>
+                                                       </li>
+
+                       {% endifnotequal %}
+
+
+        {% endfor %}
+                                               </ul>
+                                       </div>
+
+{% endif %}
+
+{% if exams %}
+
+<hr>
+
+<h1>Previous exam papers</h1>
+<p class="lead">
+       Below are the results of exams that you have sat.
+</p>
+
+<table class="table table-bordered table-striped">
+
+       <thead>
+               <tr>
+                       <th>Quiz Title</th>
+                       <th>Score</th>
+                       <th>Possible Score</th>
+                       <th>%</th>
+        </tr>
+    </thead>
+
+    <tbody>
+
+           {% for exam in exams %}
+
+               <tr>
+                       {% user_previous_exam exam %}
+               </tr>
+
+           {% endfor %}
+
+    </tbody>
+
+</table>
+
+{% endif %}
+
+</div>
+
+{% endblock %}
diff --git a/quiz/templates/question.html b/quiz/templates/question.html
new file mode 100644 (file)
index 0000000..7cfd37f
--- /dev/null
@@ -0,0 +1,74 @@
+{% extends "base.html" %}
+
+{% load quiz_tags %}
+
+{% block title %} {{ quiz.title }} {% endblock %}
+{% block description %} {{ quiz.title }} - {{ quiz.description }} {% endblock %}
+
+{% block content %}
+
+<div class="container">
+
+
+{% if previous %}
+
+        <p class="muted"><small>The previous question:</small></p>
+        <p>{{ previous.previous_question }}</p>
+
+        {% ifequal previous.previous_outcome 'correct' %}
+                       <div class="alert alert-success">
+               {% else %}
+                       <div class="alert alert-error">
+               {% endifequal %}
+
+                       <p><small>Your answer was </small><strong>{{ previous.previous_outcome }}</strong></p>
+                   </div>
+
+                       {% correct_answer previous %}
+                   <p><strong>Explanation:</strong></p>
+                   <div class="well " style="background-color: #fcf8e3;">
+                       <p>{{ previous.previous_question.explanation }}</p>
+                   </div>
+
+
+<hr>
+
+{% endif %}
+
+<br />
+
+
+{% if question %}
+
+       <p><small class="muted">Question category:</small> <strong>{{ question.category }}</strong></p>
+        <p class="lead">{{ question.content }}</p>
+
+               <form action="{% url 'quiz_question' quiz.url %}" method="get">
+                 <input type=hidden name="question_id" value="{{ question.id }}">
+
+                 <table class="table table-hover table-bordered" id="answerchoice">
+                       <tbody>
+
+                         {% ifequal question_type 'TF_Question' %}
+                             {% include 'answers_for_tf_question.html' %}
+                         {% endifequal %}
+
+                         {% ifequal question_type 'MCQuestion' %}
+                         {% answers_for_mc_question question %}
+                         {% endifequal %}
+
+                       </tbody>
+                 </table>
+                 <input type="submit" value="Check" class="btn btn-large btn-block btn-warning" >
+               </form>
+
+
+{% endif %}
+
+    <hr>
+
+
+
+</div>
+
+{% endblock %}
diff --git a/quiz/templates/quiz_index.html b/quiz/templates/quiz_index.html
new file mode 100644 (file)
index 0000000..a5466ea
--- /dev/null
@@ -0,0 +1,19 @@
+{% extends 'base.html' %}
+{% block title %}All Quizzes{% endblock %}
+
+{% block content %}
+<h2>Quiz list</h2>
+    {% if quiz_list %}
+        <ul>
+        {% for quiz in quiz_list %}
+            <li><a href="{% url 'quiz.views.quiz_take' quiz_name=quiz.url %}">{{ quiz.title }}</a></li>
+        {% endfor %}
+        </ul>
+    {% else %}
+        <p>There are no available quizzes.</p>
+    {% endif %}
+{% endblock %}
+
+{% block right-sidebar %}
+<h2>Sponsored Advertisements</h2>
+{% endblock %}
diff --git a/quiz/templates/result.html b/quiz/templates/result.html
new file mode 100644 (file)
index 0000000..c24c6d5
--- /dev/null
@@ -0,0 +1,75 @@
+{% extends "base.html" %}
+
+{% load quiz_tags %}
+
+{% block title %} Exam Paper Result {% endblock %}
+{% block description %} Exam Results {% endblock %}
+
+{% block content %}
+
+<div class="container">
+
+{% if previous %}
+
+        <p class="muted"><small>The previous question:</small></p>
+        <p>{{ previous.previous_question }}</p>
+        <p>Your answer was <strong>{{ previous.previous_outcome }}</strong></p>
+               {% correct_answer previous %}
+        <p><strong>Explanation:</strong></p>
+        <div class="well " style="background-color: #fcf8e3;">
+               <p>{{ previous.previous_question.explanation }}</p>
+        </div>
+<hr>
+
+{% endif %}
+
+{% if score %}
+
+       <div>
+               <h2>Exam results</h2>
+               <p><small class="muted">Exam title:</small> <strong>{{ quiz.title }}</strong></p>
+
+               <p class="lead">You answered {{ score }} questions correctly out of {{ max_score }}, giving you {{ percent }} percent correct</p>
+
+               <p>Review the questions below and try the exam again in the future.</p>
+
+               {% if user.is_authenticated %}
+
+                       <p>The result of this exam will be stored in your progress section so you can review and monitor your progression.</p>
+
+               {% endif %}
+        </div>
+
+
+{% endif %}
+
+
+    <hr>
+
+{% if session and possible %}
+
+    <p class="lead">Your session score is {{ session }} out of a possible {{ possible }}</p>
+
+    <hr>
+
+{% endif %}
+
+{% if questions %}
+
+       {% for question in questions %}
+
+               <p class="lead">{{ question.content }}</p>
+                       {% correct_answer_for_all_with_users_incorrect question incorrect_questions %}
+
+
+
+
+       {% endfor %}
+
+{% endif %}
+
+
+
+</div>
+
+{% endblock %}
diff --git a/quiz/templates/signup.html b/quiz/templates/signup.html
new file mode 100644 (file)
index 0000000..dbdcaad
--- /dev/null
@@ -0,0 +1,9 @@
+{% extends 'base.html' %}
+{% block title %}Progress{% endblock %}
+
+{% block content %}
+<h1>Sign up</h1>
+
+<p>Your current score is {{ anon_score }} out of {{ anon_possible }}</p>
+
+{% endblock %}
diff --git a/quiz/templates/user_previous_exam.html b/quiz/templates/user_previous_exam.html
new file mode 100644 (file)
index 0000000..42bda82
--- /dev/null
@@ -0,0 +1,4 @@
+<td>{{ title }}</td>
+<td>{{ score }}</td>
+<td>{{ possible }}</td>
+<td>{{ percent }}</td>
diff --git a/quiz/templates/view_quiz_category.html b/quiz/templates/view_quiz_category.html
new file mode 100644 (file)
index 0000000..b60a0c9
--- /dev/null
@@ -0,0 +1,20 @@
+{% extends 'base.html' %}
+{% block title %}Quizzes related to {{ category.category }}{% endblock %}
+
+{% block content %}
+<h1>Quizzes in {{ category.category }}</h1>
+
+    {% if quizzes %}
+        <ul>
+        {% for quiz in quizzes %}
+            <li>
+                         <a href="{% url 'quiz_question' quiz_name=quiz.url %}">
+                               {{ quiz.title }}
+                         </a>
+                       </li>
+        {% endfor %}
+        </ul>
+    {% else %}
+        <p>There are no quizzes</p>
+    {% endif %}
+{% endblock %}
index 02d7f278f1fe3d7a4c545e8ca5f679cdf89b0830..8543c04842ff8dc7c322fdbebe42146284e94eac 100644 (file)
@@ -14,7 +14,16 @@ def correct_answer(context, previous):
     processes the correct answer based on the previous question dict
     """
     q = previous['previous_question']
-    answers = Answer.objects.filter(question__id=q.id)
+
+    if q.__class__.__name__ == "MCQuestion":
+        answers = Answer.objects.filter(question__id=q.id)
+
+    if q.__class__.__name__ == "TF_Question":
+        answers = [{'correct': q.check_if_correct('T'),
+                    'content': 'True'},
+                   {'correct': q.check_if_correct('F'),
+                    'content': 'False'}]
+
     return {'answers': answers, }
 
 @register.inclusion_tag('correct_answer.html', takes_context=True)
@@ -31,12 +40,21 @@ def correct_answer_for_all_with_users_incorrect(context, question, incorrect_lis
     processes the correct answer based on a given question object
     if the answer is incorrect, informs the user
     """
-    answers = Answer.objects.filter(question__id=question.id)
     question_id = str(question.id)
     if question_id in incorrect_list:
         user_was_incorrect = True
     else:
         user_was_incorrect = False
+
+    if question.__class__.__name__ == "MCQuestion":
+        answers = Answer.objects.filter(question__id=question.id)
+
+    if question.__class__.__name__ == "TF_Question":
+        answers = [{'correct': question.check_if_correct('T'),
+                    'content': 'True'},
+                   {'correct': question.check_if_correct('F'),
+                    'content': 'False'}]
+
     return {'answers': answers, 'user_was_incorrect': user_was_incorrect, }
 
 @register.inclusion_tag('user_previous_exam.html', takes_context=True)
index 35dc699eb502ac11f116ab90c778d6addc9d07bc..fee80603df20dedf85c392928ef11f5b2451a8f1 100644 (file)
@@ -442,7 +442,11 @@ class TestQuestionViewsUser(TestCase):
         question2 = MCQuestion.objects.create(id = 2,
                                               content = "squeek")
         question2.quiz.add(quiz1)
-        question2.quiz.add(quiz2)
+
+        question3 = TF_Question.objects.create(id = 3,
+                                               content = "oink",
+                                               correct = True)
+        question3.quiz.add(quiz2)
 
         Answer.objects.create(id = 123,
                               question = question1,
@@ -544,13 +548,16 @@ class TestQuestionViewsUser(TestCase):
                                    {'guess': 456,
                                     'question_id': 2})
         question1 = Question.objects.get_subclass(id = 1)
-        question2 = Question.objects.get_subclass(id = 2)
+        question2 = Question.objects.get_subclass(id = 3)
 
         self.assertEqual(response.context['score'], 1)
         self.assertEqual(response.context['max_score'], 2)
         self.assertEqual(response.context['percent'], 50)
         self.assertIn(question1, response.context['questions'])
         self.assertIn(question2, response.context['questions'])
+        self.assertContains(response, 'correctly')
+        self.assertContains(response, 'incorrectly')
+        self.assertContains(response, 'True')
 
 
         sitting = Sitting.objects.get(quiz = Quiz.objects.get(id = 2),
index 7aa94a4e49adb83faf89d55866ab238a5db328c7..c288f0249c11c4830d47e0ecd500aebf811fc387 100644 (file)
@@ -192,7 +192,7 @@ def final_result_anon(request, quiz, previous):
     max_score = quiz.question_set.all().select_subclasses().count()
     percent = int(round((float(score) / max_score) * 100))
     if score == 0:
-        score = "nil points"
+        score = "0"
 
     session_score, session_possible = anon_session_score(request)
     del request.session[quiz_id + "_q_list"]
diff --git a/templates/quiz/answers_for_mc_question.html b/templates/quiz/answers_for_mc_question.html
deleted file mode 100644 (file)
index 0a06931..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-{% for answer in answers %}
-<tr>
-  <td>
-       <label>
-         <input type="radio" name="guess" value="{{ answer.id }}" class="form-radio">
-         {{ answer.content }}
-       </label>
-  </td>
-</tr>
-{% endfor %}
diff --git a/templates/quiz/answers_for_question.html b/templates/quiz/answers_for_question.html
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/templates/quiz/answers_for_tf_question.html b/templates/quiz/answers_for_tf_question.html
deleted file mode 100644 (file)
index 63c3f94..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<tr>
-  <td>
-       <label>
-         <input type="radio" name="guess" value="T" class="form-radio">
-         True
-       </label>
-  </td>
-</tr>
-<tr>
-  <td>
-       <label>
-         <input type="radio" name="guess" value="F" class="form-radio">
-         False
-       </label>
-  </td>
-</tr>
diff --git a/templates/quiz/base.html b/templates/quiz/base.html
deleted file mode 100644 (file)
index 0f68190..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
-<head>
-<meta charset="utf-8">
-
-<title>Example Quiz Website | {% block title %}{% endblock %}</title>
-<meta name="description" content="{% block description %}{% endblock %}">
-
-<link rel="author" href="https://plus.google.com/u/0/XXXXXX"/>
-       
-<link rel="shortcut icon" href="{{STATIC_URL}}img/favicon.ico" type="image/x-icon" />
-
-<!-- styles -->
-<link href="{{STATIC_URL}}css/XXX.css" rel="stylesheet">
-
-<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
-<!--[if lt IE 9]>
-<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
-<![endif]-->
-
-
-
-</head>
-
-<body>
-
-
-<!-- Before the quiz content -->
-
-
-
-{% block content %}{% endblock %}
-
-<!-- After the quiz content -->
-
-
-
-
-
-</body>
-</html>
\ No newline at end of file
diff --git a/templates/quiz/correct_answer.html b/templates/quiz/correct_answer.html
deleted file mode 100644 (file)
index 0ad26d4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-
-{% if user_was_incorrect %}
-    
-       <div class="alert alert-error">
-               
-               <strong>You answered the above question incorrectly</strong>
-               
-       </div>
-       
-    
-{% endif %}
-
-<table class="table table-striped table-bordered">
-<tbody>
-{% for answer in answers %}
-    
-    {% if answer.correct %}
-       
-       <tr class="success">
-       <td>{{ answer.content }}</td> <td><strong>correct answer</strong></td>
-
-    {% else %}
-    <tr>
-       <td>{{ answer.content }}</td><td></td>
-       
-    {% endif %}
-       </tr>
-{% endfor %}
-
-</tbody>
-</table>
\ No newline at end of file
diff --git a/templates/quiz/list_categories.html b/templates/quiz/list_categories.html
deleted file mode 100644 (file)
index 1ae019b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-{% extends 'base.html' %}
-{% block title %}All Quizzes{% endblock %}
-
-{% block content %}
-<h2>Category list</h2>
-
-<ul>
-  {% for cat in categories %}
-  <li>
-       <a href="{% url 'quiz.views.view_category' slug=cat.category %}">
-         {{ cat.category }}
-       </a>
-  </li>
-  {% endfor %}
-</ul>
-
-{% endblock %}
-
-{% block right-sidebar %}
-<h2>Sponsored Advertisements</h2>
-{% endblock %}
diff --git a/templates/quiz/progress.html b/templates/quiz/progress.html
deleted file mode 100644 (file)
index 32c6902..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-{% extends "base.html" %}
-
-{% load quiz_tags %}
-
-{% block title %} Progress Page {% endblock %}
-{% block description %} User Progress Page {% endblock %}
-
-{% block content %}
-
-<div class="container">
-
-{% if new_user %}
-
-               <div class="alert alert-block">
-                       <button type="button" class="close" data-dismiss="alert">&times;</button>
-                       <ul class="unstyled">
-                       <li>
-                               <h4>Thank you for joining this website. Welcome to your progress page.</h4>
-                       </li>
-               </ul>
-               </div>
-
-{% endif %}
-
-
-{% if cat_scores %}
-
-<h1>Question Category Scores</h1>
-<p class="lead">
-       Below are the categories of questions that you have attempted. Blue is the percentage that are correct.
-</p>
-
-<script type="text/javascript" src="http://www.google.com/jsapi"></script>
-<script type="text/javascript">
-       google.load('visualization', '1', {packages: ['corechart']});
-</script>
-
-               {% for cat, value in cat_scores.items %}
-
-                       {% ifnotequal cat "empty" %}
-
-                               {% if forloop.first %}
-                                       <div class="row">
-                                               <ul class="thumbnails">
-                               {% endif %}
-
-                               {% ifequal forloop.counter 5 %}
-                                               </ul>
-                                       </div>
-                                       <div class="row">
-                                               <ul class="thumbnails">
-                               {% endifequal %}
-
-                               {% ifequal forloop.counter 9 %}
-                                               </ul>
-                                       </div>
-                                       <div class="row">
-                                               <ul class="thumbnails">
-                               {% endifequal %}
-
-                               {% ifequal forloop.counter 13 %}
-                                               </ul>
-                                       </div>
-                                       <div class="row">
-                                               <ul class="thumbnails">
-                               {% endifequal %}
-
-                               {% ifequal forloop.counter 17 %}
-                                               </ul>
-                                       </div>
-                                       <div class="row">
-                                               <ul class="thumbnails">
-                               {% endifequal %}
-
-                                                       <li class="span3">
-                                                               <div class="thumbnail">
-                                                                                                                           <script type="text/javascript">
-                                                     function drawVisualization() {
-                                                       // Create and populate the data table.
-                                                       var difference = {{ value.1 }} - {{ value.0 }};
-                                                       var correct = {{ value.0 }};
-                                                       var data = google.visualization.arrayToDataTable([
-                                                         ["",""],
-                                                         ['Correct',  correct],
-                                                         ['Incorrect', difference]
-                                                       ]);
-
-                                                       var options = {
-                                                               legend:{position:'none'},
-                                                               title:"{{ cat }}",
-                                                               fontSize: 16
-                                                               };
-
-                                                       // Create and draw the visualization.
-                                                       new google.visualization.PieChart(document.getElementById('visualization{{ cat }}')).
-                                                           draw(data, options);
-                                                     }
-
-
-                                                     google.setOnLoadCallback(drawVisualization);
-                                                   </script>
-
-                                               <div id="visualization{{ cat }}" ></div>
-                                                               </div>
-                                                       </li>
-
-                       {% endifnotequal %}
-
-
-        {% endfor %}
-                                               </ul>
-                                       </div>
-
-{% endif %}
-
-{% if exams %}
-
-<hr>
-
-<h1>Previous exam papers</h1>
-<p class="lead">
-       Below are the results of exams that you have sat.
-</p>
-
-<table class="table table-bordered table-striped">
-
-       <thead>
-               <tr>
-                       <th>Quiz Title</th>
-                       <th>Score</th>
-                       <th>Possible Score</th>
-                       <th>%</th>
-        </tr>
-    </thead>
-
-    <tbody>
-
-           {% for exam in exams %}
-
-               <tr>
-                       {% user_previous_exam exam %}
-               </tr>
-
-           {% endfor %}
-
-    </tbody>
-
-</table>
-
-{% endif %}
-
-</div>
-
-{% endblock %}
diff --git a/templates/quiz/question.html b/templates/quiz/question.html
deleted file mode 100644 (file)
index c4913d8..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-{% extends "base.html" %}
-
-{% load quiz_tags %}
-
-{% block title %} {{ quiz.title }} {% endblock %}
-{% block description %} {{ quiz.title }} - {{ quiz.description }} {% endblock %}
-
-{% block content %}
-
-<div class="container">
-
-
-{% if previous %}
-
-        <p class="muted"><small>The previous question:</small></p>
-        <p>{{ previous.previous_question }}</p>
-
-        {% ifequal previous.previous_outcome 'correct' %}
-                       <div class="alert alert-success">
-               {% else %}
-                       <div class="alert alert-error">
-               {% endifequal %}
-
-                       <p><small>Your answer was </small><em>{{ previous.previous_answer }}</em><small> which is </small><strong>{{ previous.previous_outcome }}</strong></p>
-                   </div>
-
-                       {% correct_answer previous %}
-                   <p><strong>Explanation:</strong></p>
-                   <div class="well " style="background-color: #fcf8e3;">
-                       <p>{{ previous.previous_question.explanation }}</p>
-                   </div>
-
-
-<hr>
-
-{% endif %}
-
-<br />
-
-
-{% if question %}
-
-       <p><small class="muted">Question category:</small> <strong>{{ question.category }}</strong></p>
-               <p>{{ question.id }}</p>
-               <p>{{ question_type }}</p>
-        <p class="lead">{{ question.content }}</p>
-
-               <form action="{% url 'quiz_question' quiz.url %}" method="get">
-                 <p>quid {{ question.id }}</p>
-                 <input type=hidden name="question_id" value="{{ question.id }}">
-
-                 <table class="table table-hover table-bordered" id="answerchoice">
-                       <tbody>
-
-                         {% ifequal question_type 'TF_Question' %}
-                             {% include 'answers_for_tf_question.html' %}
-                         {% endifequal %}
-
-                         {% ifequal question_type 'MCQuestion' %}
-                         {% answers_for_mc_question question %}
-                         {% endifequal %}
-
-                       </tbody>
-                 </table>
-                 <input type="submit" value="Check" class="btn btn-large btn-block btn-warning" >
-               </form>
-
-
-{% endif %}
-
-    <hr>
-
-
-
-</div>
-
-{% endblock %}
diff --git a/templates/quiz/quiz_index.html b/templates/quiz/quiz_index.html
deleted file mode 100644 (file)
index a5466ea..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{% extends 'base.html' %}
-{% block title %}All Quizzes{% endblock %}
-
-{% block content %}
-<h2>Quiz list</h2>
-    {% if quiz_list %}
-        <ul>
-        {% for quiz in quiz_list %}
-            <li><a href="{% url 'quiz.views.quiz_take' quiz_name=quiz.url %}">{{ quiz.title }}</a></li>
-        {% endfor %}
-        </ul>
-    {% else %}
-        <p>There are no available quizzes.</p>
-    {% endif %}
-{% endblock %}
-
-{% block right-sidebar %}
-<h2>Sponsored Advertisements</h2>
-{% endblock %}
diff --git a/templates/quiz/result.html b/templates/quiz/result.html
deleted file mode 100644 (file)
index 2cb671e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-{% extends "base.html" %}
-
-{% load quiz_tags %}
-
-{% block title %} Exam Paper Result {% endblock %}
-{% block description %} Exam Results {% endblock %}
-
-{% block content %}
-
-<div class="container">
-
-{% if previous %}
-       
-        <p class="muted"><small>The previous question:</small></p> 
-        <p>{{ previous.previous_question }}</p>
-        <p>Your answer was <em>{{ previous.previous_answer }}</em> which is <strong>{{ previous.previous_outcome }}</strong></p>
-               {% correct_answer previous %}
-        <p><strong>Explanation:</strong></p>
-        <div class="well " style="background-color: #fcf8e3;">
-               <p>{{ previous.previous_question.explanation }}</p>
-        </div>
-<hr>
-       
-{% endif %}
-
-{% if score %}
-       
-       <div>
-               <h2>Exam results</h2>
-               <p><small class="muted">Exam title:</small> <strong>{{ quiz.title }}</strong></p>
-               
-               <p class="lead">You answered {{ score }} questions correctly out of {{ max_score }}, giving you {{ percent }} percent correct</p>
-               
-               <p>Review the questions below and try the exam again in the future.</p>
-               
-               {% if user.is_authenticated %}
-                       
-                       <p>The result of this exam will be stored in your progress section so you can review and monitor your progression.</p>
-               
-               {% endif %}
-        </div>
-        
-                           
-{% endif %}
-
-    
-    <hr>
-    
-{% if session and possible %}
-    
-    <p class="lead">Your session score is {{ session }} out of a possible {{ possible }}</p>
-        
-    <hr>
-    
-{% endif %}
-    
-{% if questions %}
-    
-       {% for question in questions %}
-       
-               <p class="lead">{{ question.content }}</p>
-               {% correct_answer_for_all_with_users_incorrect question incorrect_questions %}
-                       
-       {% endfor %}
-    
-{% endif %}
-
-
-
-</div>
-
-{% endblock %}
\ No newline at end of file
diff --git a/templates/quiz/signup.html b/templates/quiz/signup.html
deleted file mode 100644 (file)
index dbdcaad..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{% extends 'base.html' %}
-{% block title %}Progress{% endblock %}
-
-{% block content %}
-<h1>Sign up</h1>
-
-<p>Your current score is {{ anon_score }} out of {{ anon_possible }}</p>
-
-{% endblock %}
diff --git a/templates/quiz/user_previous_exam.html b/templates/quiz/user_previous_exam.html
deleted file mode 100644 (file)
index 42bda82..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<td>{{ title }}</td>
-<td>{{ score }}</td>
-<td>{{ possible }}</td>
-<td>{{ percent }}</td>
diff --git a/templates/quiz/view_quiz_category.html b/templates/quiz/view_quiz_category.html
deleted file mode 100644 (file)
index b60a0c9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-{% extends 'base.html' %}
-{% block title %}Quizzes related to {{ category.category }}{% endblock %}
-
-{% block content %}
-<h1>Quizzes in {{ category.category }}</h1>
-
-    {% if quizzes %}
-        <ul>
-        {% for quiz in quizzes %}
-            <li>
-                         <a href="{% url 'quiz_question' quiz_name=quiz.url %}">
-                               {{ quiz.title }}
-                         </a>
-                       </li>
-        {% endfor %}
-        </ul>
-    {% else %}
-        <p>There are no quizzes</p>
-    {% endif %}
-{% endblock %}
diff --git a/true_false/templates/answers_for_tf_question.html b/true_false/templates/answers_for_tf_question.html
new file mode 100644 (file)
index 0000000..63c3f94
--- /dev/null
@@ -0,0 +1,16 @@
+<tr>
+  <td>
+       <label>
+         <input type="radio" name="guess" value="T" class="form-radio">
+         True
+       </label>
+  </td>
+</tr>
+<tr>
+  <td>
+       <label>
+         <input type="radio" name="guess" value="F" class="form-radio">
+         False
+       </label>
+  </td>
+</tr>