footer added
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 10 Jan 2012 14:42:37 +0000 (15:42 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 10 Jan 2012 14:42:37 +0000 (15:42 +0100)
12 files changed:
apps/quiz/migrations/0002_auto__add_field_quiz_footer.py [new file with mode: 0644]
apps/quiz/models.py
apps/quiz/static/css/style.css
apps/quiz/templates/quiz/base.html [new file with mode: 0755]
apps/quiz/templates/quiz/home.html [new file with mode: 0644]
apps/quiz/templates/quiz/question_detail.html
apps/quiz/templates/quiz/result_detail.html
apps/quiz/templatetags/__init__.py [new file with mode: 0755]
apps/quiz/templatetags/quiz_tags.py [new file with mode: 0755]
koedquiz/templates/base.html
koedquiz/templates/home.html [deleted file]
koedquiz/views.py

diff --git a/apps/quiz/migrations/0002_auto__add_field_quiz_footer.py b/apps/quiz/migrations/0002_auto__add_field_quiz_footer.py
new file mode 100644 (file)
index 0000000..f53f55d
--- /dev/null
@@ -0,0 +1,63 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        
+        # Adding field 'Quiz.footer'
+        db.add_column('quiz_quiz', 'footer', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False)
+
+
+    def backwards(self, orm):
+        
+        # Deleting field 'Quiz.footer'
+        db.delete_column('quiz_quiz', 'footer')
+
+
+    models = {
+        'quiz.answer': {
+            'Meta': {'ordering': "['question', 'ordering']", 'object_name': 'Answer'},
+            'go_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'go_tos'", 'null': 'True', 'to': "orm['quiz.Question']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
+            'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Question']"}),
+            'result': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Result']", 'null': 'True', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'quiz.question': {
+            'Meta': {'ordering': "['quiz', 'ordering']", 'unique_together': "[['quiz', 'slug'], ['quiz', 'ordering']]", 'object_name': 'Question'},
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
+            'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
+            'text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'quiz.quiz': {
+            'Meta': {'ordering': "('domain',)", 'object_name': 'Quiz', '_ormbases': ['sites.Site']},
+            'description': ('django.db.models.fields.TextField', [], {}),
+            'footer': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'site_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sites.Site']", 'unique': 'True', 'primary_key': 'True'})
+        },
+        'quiz.result': {
+            'Meta': {'ordering': "['quiz', 'title']", 'object_name': 'Result'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
+            'text': ('django.db.models.fields.TextField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'sites.site': {
+            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
+            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        }
+    }
+
+    complete_apps = ['quiz']
index 7c71635..b5e588d 100644 (file)
@@ -11,6 +11,7 @@ from django.conf import settings
 
 class Quiz(Site):
     description = models.TextField()
+    footer = models.TextField(null=True, blank=True)
 
     class Meta:
         verbose_name = _('quiz')
index ca377e4..2f22527 100755 (executable)
@@ -82,3 +82,17 @@ a.big-button:hover, a.button:hover {
     border: 1px solid #ddd;
     border-radius: 1em;
 }
+footer {
+    font-size: .67em;
+    color: #aaa;
+    padding: .5em;
+    margin-top: 3em;
+    border-top: 1px solid #eee;
+}
+footer a {
+    color: #777;
+    text-decoration: none;
+}
+footer p {
+    margin-top: 0;
+}
\ No newline at end of file
diff --git a/apps/quiz/templates/quiz/base.html b/apps/quiz/templates/quiz/base.html
new file mode 100755 (executable)
index 0000000..bbfa9ea
--- /dev/null
@@ -0,0 +1,6 @@
+{% extends "base.html" %}
+{% load quiz_tags %}
+
+{% block footerextra %}
+{% quiz_footer %}
+{% endblock %}
diff --git a/apps/quiz/templates/quiz/home.html b/apps/quiz/templates/quiz/home.html
new file mode 100644 (file)
index 0000000..34efdd7
--- /dev/null
@@ -0,0 +1,17 @@
+{% extends "quiz/base.html" %}
+{% load i18n %}
+
+
+{% block "title" %}{{ quiz.name }}{% endblock %}
+{% block "header" %}{{ quiz.name }}{% endblock %}
+
+
+{% block "body" %}
+
+<div>
+{{ quiz.description|safe }}
+</div>
+
+<a class='big-button' href="{{ quiz.get_absolute_url }}">{% trans "Start the test!" %}</a>
+
+{% endblock %}
index 32518a3..c219434 100755 (executable)
@@ -1,4 +1,4 @@
-{% extends "base.html" %}
+{% extends "quiz/base.html" %}
 {% load i18n %}
 {% load url from future %}
 
index 2da4bfa..4b04ef2 100755 (executable)
@@ -1,4 +1,4 @@
-{% extends "base.html" %}
+{% extends "quiz/base.html" %}
 {% load i18n %}
 {% load url from future %}
 
diff --git a/apps/quiz/templatetags/__init__.py b/apps/quiz/templatetags/__init__.py
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/apps/quiz/templatetags/quiz_tags.py b/apps/quiz/templatetags/quiz_tags.py
new file mode 100755 (executable)
index 0000000..2790ae2
--- /dev/null
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+# This file is part of KOED-Quiz, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from django import template
+from django.utils.safestring import mark_safe
+from quiz.models import Quiz
+
+register = template.Library()
+
+
+@register.simple_tag
+def quiz_footer():
+    return mark_safe(Quiz.current().footer)
index cc33400..6933391 100644 (file)
     <div id="body">
         {% block "body" %}{% endblock %}
     </div>
+
+    <footer>
+        <p>
+        <a href="https://github.com/fnp/koed-quiz/">Kod źródłowy</a> dostępny
+        na licencji <a href="http://www.gnu.org/licenses/agpl.html">GNU AGPL</a>.
+        Autor: Radosław Czajka. Copyright ©
+        <a href="http://nowoczesnapolska.org.pl">Fundacja Nowoczesna Polska</a>.
+        </p>
+        {% block footerextra %}{% endblock %}
+    </footer>
+
 </body>
 
 </html>
diff --git a/koedquiz/templates/home.html b/koedquiz/templates/home.html
deleted file mode 100644 (file)
index b4c1d20..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-
-
-{% block "title" %}{{ quiz.name }}{% endblock %}
-{% block "header" %}{{ quiz.name }}{% endblock %}
-
-
-{% block "body" %}
-
-<div>
-{{ quiz.description|safe }}
-</div>
-
-<a class='big-button' href="{{ quiz.get_absolute_url }}">{% trans "Start the test!" %}</a>
-
-{% endblock %}
index 7dfbdd9..b89fdda 100644 (file)
@@ -10,4 +10,4 @@ from quiz.models import Quiz
 
 def home(request):
     quiz = Quiz.current()
-    return render(request, "home.html", locals())
+    return render(request, "quiz/home.html", locals())