+===============
Django quiz app
===============
tried to strip out anything from the template files that are dependant
on bootstrap.
-.. figure:: http://i.imgur.com/VRYx3OV.png
- :alt: Question picture hosted by Imgur
+.. image:: http://i.imgur.com/VRYx3OV.png
+
- Questions
Current features
----------------
-Features of each quiz: \* Question order randomisation \* Storing of
-quiz results under each user \* Previous quiz scores can be viewed on
-category page \* Correct answers can be shown after each question or all
-at once at the end \* Logged in users can return to an incomplete quiz
-to finish it and non-logged in users can complete a quiz if their
-session persists \* The quiz can be limited to one attempt per user \*
-Questions can be given a category \* Success rate for each category can
-be monitored on a progress page \* Explanation for each question result
-can be given \* Multiple choice question type \* True/False question
-type
-
-.. figure:: http://i.imgur.com/UJtRZxo.png
- :alt: Result picture hosted by Imgur
-
- Result page
+* Question order randomisation
+* Storing of quiz results under each user
+* Previous quiz scores can be viewed on category page
+* Correct answers can be shown after each question or all at once at the end
+* Logged in users can return to an incomplete quiz to finish it and non-logged in users can complete a quiz if their session persists
+* The quiz can be limited to one attempt per user
+* Questions can be given a category
+* Success rate for each category can be monitored on a progress page
+* Explanation for each question result can be given
+* Multiple choice question type
+* True/False question type
+
+.. image:: http://i.imgur.com/UJtRZxo.png
+
Requirements
------------
------------
Clone the repo with
-``git clone https://github.com/tomwalker/django_quiz.git``.
+ .. code-block:: bash
+ ``git clone https://github.com/tomwalker/django_quiz.git``.
Run ``pip install -r requirements.txt``.
Add ``'quiz', 'multichoice', 'true_false',`` to your ``INSTALLED_APPS``
setting.
-::
-
- INSTALLED_APPS = (
- ...
- 'quiz',
- 'multichoice',
- 'true_false',
- ...
- )
+ .. code-block:: python
+ INSTALLED_APPS = (
+ ...
+ 'quiz',
+ 'multichoice',
+ 'true_false',
+ ...
+ )
Add the following to your projects ``urls.py`` file, substituting ``q``
for whatever you want the quiz base url to be.
-::
-
- urlpatterns = patterns('',
- ...
- url(r'^q/', include('quiz.urls')),
- ...
- )
+ .. code-block:: python
+ urlpatterns = patterns('',
+ ...
+ url(r'^q/', include('quiz.urls')),
+ ...
+ )
This is my first open source project so please forgive any problems
and/or dreadful code!
from multichoice.models import MCQuestion, Answer
from true_false.models import TF_Question
+
class QuestionInline(admin.TabularInline):
model = Question.quiz.through
filter_horizontal = ('content',)
"""
below is from
-http://stackoverflow.com/questions/11657682/django-admin-interface-using-horizontal-filter-with-
+http://stackoverflow.com/questions/11657682/
+django-admin-interface-using-horizontal-filter-with-
inline-manytomany-field
"""
+
class QuizAdminForm(forms.ModelForm):
class Meta:
model = Quiz
questions = forms.ModelMultipleChoiceField(
- queryset = Question.objects.all().select_subclasses(),
- required = False,
- widget = FilteredSelectMultiple(verbose_name = ('Questions'),
- is_stacked = False))
+ queryset=Question.objects.all().select_subclasses(),
+ required=False,
+ widget=FilteredSelectMultiple(
+ verbose_name=('Questions'),
+ is_stacked=False))
def __init__(self, *args, **kwargs):
super(QuizAdminForm, self).__init__(*args, **kwargs)
class CategoryAdmin(admin.ModelAdmin):
search_fields = ('category', )
+
class MCQuestionAdmin(admin.ModelAdmin):
list_display = ('content', 'category', )
list_filter = ('category',)
- fields = ('content', 'category', 'quiz', 'explanation' )
+ fields = ('content', 'category', 'quiz', 'explanation')
search_fields = ('content', )
filter_horizontal = ('quiz',)
-
inlines = [AnswerInline]
"""
search_fields = ('user', 'score', )
+
class TFQuestionAdmin(admin.ModelAdmin):
list_display = ('content', 'category', )
list_filter = ('category',)
from django import forms
from django.forms.models import inlineformset_factory
-
-from multichoice.models import Question, Answer
-
-import os
from setuptools import setup
-README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
-
-os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
+readme = open('README.rst').read()
setup(
name='django-quiz-app',
- version='0.3.1',
+ version='0.4.0',
packages=['quiz', 'multichoice', 'true_false'],
include_package_data=True,
license='MIT License',
description='A configurable quiz app for Django.',
- long_description=README,
+ long_description=readme,
url='https://github.com/tomwalker/django_quiz',
author='Tom Walker',
author_email='tomwalker0472@gmail.com',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
install_requires=[
- 'django-model-utils == 2.0.3',
- 'Django >= 1.5.1',
+ 'django-model-utils == 2.0.3',
+ 'Django >= 1.5.1',
],
)