From d7a894bd808f050903f869f3b0071e7f16a1f65e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 3 Aug 2018 22:23:16 +0100 Subject: [PATCH] Add subtitle field --- .../migrations/0005_auto_20180803_2106.py | 25 +++++++++++++++++++ project/common/models.py | 6 +++++ .../home/migrations/0006_homepage_subtitle.py | 19 ++++++++++++++ .../migrations/0004_auto_20180803_2106.py | 25 +++++++++++++++++++ templates/common/content.html | 4 ++- 5 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 project/blog/migrations/0005_auto_20180803_2106.py create mode 100644 project/home/migrations/0006_homepage_subtitle.py create mode 100644 project/pages/migrations/0004_auto_20180803_2106.py diff --git a/project/blog/migrations/0005_auto_20180803_2106.py b/project/blog/migrations/0005_auto_20180803_2106.py new file mode 100644 index 0000000..4bd5435 --- /dev/null +++ b/project/blog/migrations/0005_auto_20180803_2106.py @@ -0,0 +1,25 @@ +# Generated by Django 2.0.7 on 2018-08-03 21:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0004_auto_20180730_1721'), + ] + + operations = [ + migrations.AddField( + model_name='blogindexpage', + name='subtitle', + field=models.CharField(default='', max_length=255), + preserve_default=False, + ), + migrations.AddField( + model_name='blogpage', + name='subtitle', + field=models.CharField(default='', max_length=255), + preserve_default=False, + ), + ] diff --git a/project/common/models.py b/project/common/models.py index c7c8c34..21a930a 100644 --- a/project/common/models.py +++ b/project/common/models.py @@ -13,6 +13,8 @@ SHORT_BODY_LENGTH = 30 class Entity(MetadataPageMixin, Page): is_home = False + subtitle = models.CharField(max_length=255) + created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) post_date = models.DateTimeField(null=True, blank=True) @@ -27,6 +29,10 @@ class Entity(MetadataPageMixin, Page): ], 'Common page configuration'), ] + content_panels = Page.content_panels + [ + FieldPanel('subtitle'), + ] + @property def image(self): return self.search_image diff --git a/project/home/migrations/0006_homepage_subtitle.py b/project/home/migrations/0006_homepage_subtitle.py new file mode 100644 index 0000000..caf1d83 --- /dev/null +++ b/project/home/migrations/0006_homepage_subtitle.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.7 on 2018-08-03 21:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0005_auto_20180730_1721'), + ] + + operations = [ + migrations.AddField( + model_name='homepage', + name='subtitle', + field=models.CharField(default='', max_length=255), + preserve_default=False, + ), + ] diff --git a/project/pages/migrations/0004_auto_20180803_2106.py b/project/pages/migrations/0004_auto_20180803_2106.py new file mode 100644 index 0000000..3153b45 --- /dev/null +++ b/project/pages/migrations/0004_auto_20180803_2106.py @@ -0,0 +1,25 @@ +# Generated by Django 2.0.7 on 2018-08-03 21:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0003_auto_20180730_1721'), + ] + + operations = [ + migrations.AddField( + model_name='sectionindexpage', + name='subtitle', + field=models.CharField(default='', max_length=255), + preserve_default=False, + ), + migrations.AddField( + model_name='simplecontentpage', + name='subtitle', + field=models.CharField(default='', max_length=255), + preserve_default=False, + ), + ] diff --git a/templates/common/content.html b/templates/common/content.html index ac4aaa1..4ee4840 100644 --- a/templates/common/content.html +++ b/templates/common/content.html @@ -7,7 +7,9 @@ {% endif %} {% include "common/breadcrumbs/index.html" %}

{{ page.title }}

-
Subtitle
+{% if page.subtitle %} +
{{ page.subtitle }}
+{% endif %}

{% include "common/content-details.html" with page=page %}