From c4823a6fcb13ca970f868433dd6a4d00bf0530f6 Mon Sep 17 00:00:00 2001 From: Scot Hacker Date: Fri, 3 Mar 2017 00:05:20 -0800 Subject: [PATCH] Move body field from most models and into BasePageFieldsMixin --- .../base/migrations/0015_gallerypage_body.py | 24 +++++++++++++++ .../migrations/0016_auto_20170303_0800.py | 24 +++++++++++++++ bakerydemo/base/models.py | 4 +++ .../migrations/0006_remove_blogpage_body.py | 19 ++++++++++++ .../migrations/0007_auto_20170303_0745.py | 29 +++++++++++++++++++ .../migrations/0008_auto_20170303_0800.py | 29 +++++++++++++++++++ bakerydemo/blog/models.py | 4 --- .../migrations/0006_remove_breadpage_body.py | 19 ++++++++++++ .../migrations/0007_auto_20170303_0745.py | 29 +++++++++++++++++++ .../migrations/0008_auto_20170303_0800.py | 29 +++++++++++++++++++ bakerydemo/breads/models.py | 6 ---- .../0012_remove_locationpage_body.py | 19 ++++++++++++ .../migrations/0013_auto_20170303_0745.py | 29 +++++++++++++++++++ .../migrations/0014_auto_20170303_0800.py | 29 +++++++++++++++++++ bakerydemo/locations/models.py | 9 +----- 15 files changed, 284 insertions(+), 18 deletions(-) create mode 100644 bakerydemo/base/migrations/0015_gallerypage_body.py create mode 100644 bakerydemo/base/migrations/0016_auto_20170303_0800.py create mode 100644 bakerydemo/blog/migrations/0006_remove_blogpage_body.py create mode 100644 bakerydemo/blog/migrations/0007_auto_20170303_0745.py create mode 100644 bakerydemo/blog/migrations/0008_auto_20170303_0800.py create mode 100644 bakerydemo/breads/migrations/0006_remove_breadpage_body.py create mode 100644 bakerydemo/breads/migrations/0007_auto_20170303_0745.py create mode 100644 bakerydemo/breads/migrations/0008_auto_20170303_0800.py create mode 100644 bakerydemo/locations/migrations/0012_remove_locationpage_body.py create mode 100644 bakerydemo/locations/migrations/0013_auto_20170303_0745.py create mode 100644 bakerydemo/locations/migrations/0014_auto_20170303_0800.py diff --git a/bakerydemo/base/migrations/0015_gallerypage_body.py b/bakerydemo/base/migrations/0015_gallerypage_body.py new file mode 100644 index 0000000..9155ede --- /dev/null +++ b/bakerydemo/base/migrations/0015_gallerypage_body.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 07:45 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0014_merge_20170228_1619'), + ] + + operations = [ + migrations.AddField( + model_name='gallerypage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='About this location'), + ), + ] diff --git a/bakerydemo/base/migrations/0016_auto_20170303_0800.py b/bakerydemo/base/migrations/0016_auto_20170303_0800.py new file mode 100644 index 0000000..7db688d --- /dev/null +++ b/bakerydemo/base/migrations/0016_auto_20170303_0800.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 08:00 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0015_gallerypage_body'), + ] + + operations = [ + migrations.AlterField( + model_name='gallerypage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/base/models.py b/bakerydemo/base/models.py index 262ef70..141e7ce 100644 --- a/bakerydemo/base/models.py +++ b/bakerydemo/base/models.py @@ -34,10 +34,14 @@ class BasePageFieldsMixin(models.Model): related_name='+', help_text='Landscape mode only; horizontal width between 1000px and 3000px.' ) + body = StreamField( + BaseStreamBlock(), verbose_name="Page body", blank=True + ) content_panels = Page.content_panels + [ FieldPanel('introduction', classname="full"), ImageChooserPanel('image'), + StreamFieldPanel('body'), ] class Meta: diff --git a/bakerydemo/blog/migrations/0006_remove_blogpage_body.py b/bakerydemo/blog/migrations/0006_remove_blogpage_body.py new file mode 100644 index 0000000..6e203ec --- /dev/null +++ b/bakerydemo/blog/migrations/0006_remove_blogpage_body.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 07:43 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0005_auto_20170220_0111'), + ] + + operations = [ + migrations.RemoveField( + model_name='blogpage', + name='body', + ), + ] diff --git a/bakerydemo/blog/migrations/0007_auto_20170303_0745.py b/bakerydemo/blog/migrations/0007_auto_20170303_0745.py new file mode 100644 index 0000000..4968a17 --- /dev/null +++ b/bakerydemo/blog/migrations/0007_auto_20170303_0745.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 07:45 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0006_remove_blogpage_body'), + ] + + operations = [ + migrations.AddField( + model_name='blogindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='About this location'), + ), + migrations.AddField( + model_name='blogpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='About this location'), + ), + ] diff --git a/bakerydemo/blog/migrations/0008_auto_20170303_0800.py b/bakerydemo/blog/migrations/0008_auto_20170303_0800.py new file mode 100644 index 0000000..30437a1 --- /dev/null +++ b/bakerydemo/blog/migrations/0008_auto_20170303_0800.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 08:00 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0007_auto_20170303_0745'), + ] + + operations = [ + migrations.AlterField( + model_name='blogindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Page body'), + ), + migrations.AlterField( + model_name='blogpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/blog/models.py b/bakerydemo/blog/models.py index 05f997d..d7474b0 100644 --- a/bakerydemo/blog/models.py +++ b/bakerydemo/blog/models.py @@ -49,12 +49,8 @@ class BlogPage(BasePageFieldsMixin, Page): subtitle = models.CharField(blank=True, max_length=255) tags = ClusterTaggableManager(through=BlogPageTag, blank=True) date_published = models.DateField("Date article published", blank=True, null=True) - body = StreamField( - BaseStreamBlock(), verbose_name="Blog post", blank=True - ) content_panels = BasePageFieldsMixin.content_panels + [ - StreamFieldPanel('body'), FieldPanel('date_published'), InlinePanel( 'blog_person_relationship', label="Author(s)", diff --git a/bakerydemo/breads/migrations/0006_remove_breadpage_body.py b/bakerydemo/breads/migrations/0006_remove_breadpage_body.py new file mode 100644 index 0000000..08cc4e4 --- /dev/null +++ b/bakerydemo/breads/migrations/0006_remove_breadpage_body.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 07:43 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('breads', '0005_auto_20170224_1047'), + ] + + operations = [ + migrations.RemoveField( + model_name='breadpage', + name='body', + ), + ] diff --git a/bakerydemo/breads/migrations/0007_auto_20170303_0745.py b/bakerydemo/breads/migrations/0007_auto_20170303_0745.py new file mode 100644 index 0000000..53eba33 --- /dev/null +++ b/bakerydemo/breads/migrations/0007_auto_20170303_0745.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 07:45 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('breads', '0006_remove_breadpage_body'), + ] + + operations = [ + migrations.AddField( + model_name='breadpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='About this location'), + ), + migrations.AddField( + model_name='breadsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='About this location'), + ), + ] diff --git a/bakerydemo/breads/migrations/0008_auto_20170303_0800.py b/bakerydemo/breads/migrations/0008_auto_20170303_0800.py new file mode 100644 index 0000000..cd18bdf --- /dev/null +++ b/bakerydemo/breads/migrations/0008_auto_20170303_0800.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 08:00 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('breads', '0007_auto_20170303_0745'), + ] + + operations = [ + migrations.AlterField( + model_name='breadpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Page body'), + ), + migrations.AlterField( + model_name='breadsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/breads/models.py b/bakerydemo/breads/models.py index d5e7b63..b983efd 100644 --- a/bakerydemo/breads/models.py +++ b/bakerydemo/breads/models.py @@ -82,9 +82,6 @@ class BreadPage(BasePageFieldsMixin, Page): null=True, blank=True, ) - body = StreamField( - BaseStreamBlock(), verbose_name="Describe the bread", blank=True - ) bread_type = models.ForeignKey( 'breads.BreadType', null=True, @@ -95,7 +92,6 @@ class BreadPage(BasePageFieldsMixin, Page): ingredients = ParentalManyToManyField('BreadIngredient', blank=True) content_panels = BasePageFieldsMixin.content_panels + [ - StreamFieldPanel('body'), FieldPanel('origin'), FieldPanel('bread_type'), MultiFieldPanel( @@ -117,8 +113,6 @@ class BreadPage(BasePageFieldsMixin, Page): parent_page_types = ['BreadsIndexPage'] - api_fields = ['title', 'bread_type', 'origin', 'image'] - class BreadsIndexPage(BasePageFieldsMixin, Page): """ diff --git a/bakerydemo/locations/migrations/0012_remove_locationpage_body.py b/bakerydemo/locations/migrations/0012_remove_locationpage_body.py new file mode 100644 index 0000000..f33ef67 --- /dev/null +++ b/bakerydemo/locations/migrations/0012_remove_locationpage_body.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 07:43 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0011_auto_20170220_0111'), + ] + + operations = [ + migrations.RemoveField( + model_name='locationpage', + name='body', + ), + ] diff --git a/bakerydemo/locations/migrations/0013_auto_20170303_0745.py b/bakerydemo/locations/migrations/0013_auto_20170303_0745.py new file mode 100644 index 0000000..8fcfbb0 --- /dev/null +++ b/bakerydemo/locations/migrations/0013_auto_20170303_0745.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 07:45 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0012_remove_locationpage_body'), + ] + + operations = [ + migrations.AddField( + model_name='locationpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='About this location'), + ), + migrations.AddField( + model_name='locationsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='About this location'), + ), + ] diff --git a/bakerydemo/locations/migrations/0014_auto_20170303_0800.py b/bakerydemo/locations/migrations/0014_auto_20170303_0800.py new file mode 100644 index 0000000..22836ce --- /dev/null +++ b/bakerydemo/locations/migrations/0014_auto_20170303_0800.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-03-03 08:00 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0013_auto_20170303_0745'), + ] + + operations = [ + migrations.AlterField( + model_name='locationpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Page body'), + ), + migrations.AlterField( + model_name='locationsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('text', wagtail.wagtailcore.blocks.TextBlock()), ('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False))))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/locations/models.py b/bakerydemo/locations/models.py index aecac77..89fb8f6 100644 --- a/bakerydemo/locations/models.py +++ b/bakerydemo/locations/models.py @@ -125,22 +125,15 @@ class LocationPage(BasePageFieldsMixin, Page): ), ] ) - body = StreamField( - BaseStreamBlock(), verbose_name="About this location", blank=True - ) - # We've defined the StreamBlock() within blocks.py that we've imported on - # line 12. Defining it in a different file gives us consistency across the - # site, though StreamFields _can_ be created on a per model basis if you - # have a use case for it # Search index configuration search_fields = Page.search_fields + [ index.SearchField('address'), + index.SearchField('body'), ] # Editor panels configuration content_panels = BasePageFieldsMixin.content_panels + [ - StreamFieldPanel('body'), FieldPanel('address', classname="full"), FieldPanel('lat_long'), InlinePanel('hours_of_operation', label="Hours of Operation"),