]> git.parisson.com Git - django_quiz.git/commitdiff
pep8 related clean ups, updated for new push to pypi
authorTom Walker <tomwalker0472@gmail.com>
Sun, 13 Jul 2014 20:09:07 +0000 (21:09 +0100)
committerTom Walker <tomwalker0472@gmail.com>
Sun, 13 Jul 2014 20:09:07 +0000 (21:09 +0100)
README.rst
quiz/admin.py
quiz/forms.py
setup.py

index 8d60721562368f62ddbb175c22f9f334a8381291..774445421453baec57e1c551cd875119f320dd50 100644 (file)
@@ -1,3 +1,4 @@
+===============
 Django quiz app
 ===============
 
@@ -10,28 +11,26 @@ My websites have used twitter bootstrap for the front end and I have
 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
 ------------
 
@@ -43,33 +42,32 @@ Installation
 ------------
 
 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!
index be1a4f6927de2af00f0d02663fc299c20d684584..2517bd9b9e7fe5e76545f83502c1a61d4b6ca4c3 100644 (file)
@@ -6,6 +6,7 @@ from .models import Quiz, Category, Progress, Question
 from multichoice.models import MCQuestion, Answer
 from true_false.models import TF_Question
 
+
 class QuestionInline(admin.TabularInline):
     model = Question.quiz.through
     filter_horizontal = ('content',)
@@ -16,19 +17,22 @@ class AnswerInline(admin.TabularInline):
 
 """
 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)
@@ -56,15 +60,15 @@ class QuizAdmin(admin.ModelAdmin):
 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]
 
 
@@ -75,6 +79,7 @@ class ProgressAdmin(admin.ModelAdmin):
     """
     search_fields = ('user', 'score', )
 
+
 class TFQuestionAdmin(admin.ModelAdmin):
     list_display = ('content', 'category', )
     list_filter = ('category',)
index 46328a0fb72606d71083f44879f2b5f24a5d9c73..9afb3cfc22b97390c18dc7a4c4ebd9f6c563b03b 100644 (file)
@@ -1,5 +1,2 @@
 from django import forms
 from django.forms.models import inlineformset_factory
-
-from multichoice.models import Question, Answer
-
index afd0617b4010e0f6e1d37e54cf6245719247271e..9c6072e3dfb5abf346217c9fc379f3848eb0c743 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,18 +1,15 @@
-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',
@@ -29,7 +26,7 @@ setup(
         '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',
     ],
 )