From: Radek Czajka Date: Tue, 10 Jan 2012 14:42:37 +0000 (+0100) Subject: footer added X-Git-Url: https://git.mdrn.pl/koed-quiz.git/commitdiff_plain/30eda91159999122d1106432f7f56d4dbc5a07c7?ds=inline;hp=b16cd2217f48dd418def72c91ba289b29a781762 footer added --- 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 index 0000000..f53f55d --- /dev/null +++ b/apps/quiz/migrations/0002_auto__add_field_quiz_footer.py @@ -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'] diff --git a/apps/quiz/models.py b/apps/quiz/models.py index 7c71635..b5e588d 100644 --- a/apps/quiz/models.py +++ b/apps/quiz/models.py @@ -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') diff --git a/apps/quiz/static/css/style.css b/apps/quiz/static/css/style.css index ca377e4..2f22527 100755 --- a/apps/quiz/static/css/style.css +++ b/apps/quiz/static/css/style.css @@ -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 index 0000000..bbfa9ea --- /dev/null +++ b/apps/quiz/templates/quiz/base.html @@ -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 index 0000000..34efdd7 --- /dev/null +++ b/apps/quiz/templates/quiz/home.html @@ -0,0 +1,17 @@ +{% extends "quiz/base.html" %} +{% load i18n %} + + +{% block "title" %}{{ quiz.name }}{% endblock %} +{% block "header" %}{{ quiz.name }}{% endblock %} + + +{% block "body" %} + +
+{{ quiz.description|safe }} +
+ +{% trans "Start the test!" %} + +{% endblock %} diff --git a/apps/quiz/templates/quiz/question_detail.html b/apps/quiz/templates/quiz/question_detail.html index 32518a3..c219434 100755 --- a/apps/quiz/templates/quiz/question_detail.html +++ b/apps/quiz/templates/quiz/question_detail.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "quiz/base.html" %} {% load i18n %} {% load url from future %} diff --git a/apps/quiz/templates/quiz/result_detail.html b/apps/quiz/templates/quiz/result_detail.html index 2da4bfa..4b04ef2 100755 --- a/apps/quiz/templates/quiz/result_detail.html +++ b/apps/quiz/templates/quiz/result_detail.html @@ -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 index 0000000..e69de29 diff --git a/apps/quiz/templatetags/quiz_tags.py b/apps/quiz/templatetags/quiz_tags.py new file mode 100755 index 0000000..2790ae2 --- /dev/null +++ b/apps/quiz/templatetags/quiz_tags.py @@ -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) diff --git a/koedquiz/templates/base.html b/koedquiz/templates/base.html index cc33400..6933391 100644 --- a/koedquiz/templates/base.html +++ b/koedquiz/templates/base.html @@ -15,6 +15,17 @@
{% block "body" %}{% endblock %}
+ + + diff --git a/koedquiz/templates/home.html b/koedquiz/templates/home.html deleted file mode 100644 index b4c1d20..0000000 --- a/koedquiz/templates/home.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - - -{% block "title" %}{{ quiz.name }}{% endblock %} -{% block "header" %}{{ quiz.name }}{% endblock %} - - -{% block "body" %} - -
-{{ quiz.description|safe }} -
- -{% trans "Start the test!" %} - -{% endblock %} diff --git a/koedquiz/views.py b/koedquiz/views.py index 7dfbdd9..b89fdda 100644 --- a/koedquiz/views.py +++ b/koedquiz/views.py @@ -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())