Browse Source

resolve merge conflicts

David Ray 8 years ago
parent
commit
87ced7ad8f

+ 23 - 0
bakerydemo/base/migrations/0003_footertext.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-02-10 13:38
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import wagtail.wagtailcore.fields
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('base', '0002_auto_20170210_1217'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='FooterText',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('body', wagtail.wagtailcore.fields.RichTextField()),
+            ],
+        ),
+    ]

+ 17 - 2
bakerydemo/base/models.py

@@ -5,12 +5,12 @@ from django.db import models
 from modelcluster.fields import ParentalKey
 from modelcluster.models import ClusterableModel
 
+from wagtail.contrib.modeladmin.options import (
+    ModelAdmin, ModelAdminGroup, modeladmin_register)
 from wagtail.wagtailadmin.edit_handlers import (
     FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel,
     PageChooserPanel, StreamFieldPanel,
 )
-from wagtail.contrib.modeladmin.options import (
-    ModelAdmin, ModelAdminGroup, modeladmin_register)
 from wagtail.wagtailcore.fields import RichTextField, StreamField
 from wagtail.wagtailcore.models import Collection, Orderable, Page
 from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
@@ -64,6 +64,21 @@ class People(ClusterableModel):
         verbose_name_plural = 'People'
 
 
+@register_snippet
+class FooterText(models.Model):
+    body = RichTextField()
+
+    panels = [
+        FieldPanel('body'),
+    ]
+
+    def __str__(self):
+        return "Footer text"
+
+    class Meta:
+        verbose_name_plural = 'Footer Text'
+
+
 class AboutLocationRelationship(Orderable, models.Model):
     """
     This defines the relationship between the `LocationPage` within the `locations`

+ 12 - 0
bakerydemo/base/templatetags/navigation_tags.py

@@ -2,6 +2,9 @@ from django import template
 
 from wagtail.wagtailcore.models import Page
 
+from bakerydemo.base.models import FooterText
+
+
 register = template.Library()
 # https://docs.djangoproject.com/en/1.9/howto/custom-template-tags/
 
@@ -86,3 +89,12 @@ def breadcrumbs(context):
         'ancestors': ancestors,
         'request': context['request'],
     }
+
+
+@register.inclusion_tag('base/include/footer.html', takes_context=True)
+def get_footer_text(context):
+    footer_text = FooterText.objects.first().body
+
+    return {
+        'footer_text': footer_text,
+    }

+ 1 - 1
bakerydemo/templates/base.html

@@ -165,7 +165,7 @@
                             </a>
                         </li>
                     </ul>
-                    <p class="copyright text-muted">Copyright &copy; Your Website 2016</p>
+                    <p class="copyright text-muted">{% get_footer_text %}</p>
                 </div>
             </div>
         </div>

+ 4 - 0
bakerydemo/templates/base/include/footer.html

@@ -0,0 +1,4 @@
+{% load wagtailcore_tags %}
+
+
+{{ footer_text|richtext }}