diff --git a/bakerydemo/base/migrations/0008_use_json_field_for_body_streamfield.py b/bakerydemo/base/migrations/0008_use_json_field_for_body_streamfield.py new file mode 100644 index 0000000..3a8615e --- /dev/null +++ b/bakerydemo/base/migrations/0008_use_json_field_for_body_streamfield.py @@ -0,0 +1,37 @@ +# Generated by Django 4.0.5 on 2022-06-15 10:49 + +from django.db import migrations +import wagtail.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0007_alter_formfield_choices_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='formpage', + name='body', + field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph_block', wagtail.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('block_quote', wagtail.blocks.StructBlock([('text', wagtail.blocks.TextBlock()), ('attribute_name', wagtail.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))])), ('embed_block', wagtail.embeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))], use_json_field=True), + ), + migrations.AlterField( + model_name='gallerypage', + name='body', + field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph_block', wagtail.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('block_quote', wagtail.blocks.StructBlock([('text', wagtail.blocks.TextBlock()), ('attribute_name', wagtail.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))])), ('embed_block', wagtail.embeds.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, use_json_field=True, verbose_name='Page body'), + ), + migrations.AlterField( + model_name='homepage', + name='body', + field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph_block', wagtail.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('block_quote', wagtail.blocks.StructBlock([('text', wagtail.blocks.TextBlock()), ('attribute_name', wagtail.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))])), ('embed_block', wagtail.embeds.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, use_json_field=True, verbose_name='Home content block'), + ), + migrations.AlterField( + model_name='standardpage', + name='body', + field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph_block', wagtail.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('block_quote', wagtail.blocks.StructBlock([('text', wagtail.blocks.TextBlock()), ('attribute_name', wagtail.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))])), ('embed_block', wagtail.embeds.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, use_json_field=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/base/models.py b/bakerydemo/base/models.py index b30a9ec..cfec7af 100644 --- a/bakerydemo/base/models.py +++ b/bakerydemo/base/models.py @@ -119,7 +119,7 @@ class StandardPage(Page): help_text='Landscape mode only; horizontal width between 1000px and 3000px.' ) body = StreamField( - BaseStreamBlock(), verbose_name="Page body", blank=True + BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True ) content_panels = Page.content_panels + [ FieldPanel('introduction', classname="full"), @@ -169,7 +169,7 @@ class HomePage(Page): # Body section of the HomePage body = StreamField( - BaseStreamBlock(), verbose_name="Home content block", blank=True + BaseStreamBlock(), verbose_name="Home content block", blank=True, use_json_field=True ) # Promo section of the HomePage @@ -301,7 +301,7 @@ class GalleryPage(Page): '3000px.' ) body = StreamField( - BaseStreamBlock(), verbose_name="Page body", blank=True + BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True ) collection = models.ForeignKey( Collection, @@ -344,7 +344,7 @@ class FormPage(AbstractEmailForm): on_delete=models.SET_NULL, related_name='+' ) - body = StreamField(BaseStreamBlock()) + body = StreamField(BaseStreamBlock(), use_json_field=True) thank_you_text = RichTextField(blank=True) # Note how we include the FormField object via an InlinePanel using the diff --git a/bakerydemo/blog/migrations/0005_use_json_field_for_body_streamfield.py b/bakerydemo/blog/migrations/0005_use_json_field_for_body_streamfield.py new file mode 100644 index 0000000..7babb8e --- /dev/null +++ b/bakerydemo/blog/migrations/0005_use_json_field_for_body_streamfield.py @@ -0,0 +1,22 @@ +# Generated by Django 4.0.5 on 2022-06-15 10:49 + +from django.db import migrations +import wagtail.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0004_alter_blogpagetag_tag'), + ] + + operations = [ + migrations.AlterField( + model_name='blogpage', + name='body', + field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph_block', wagtail.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('block_quote', wagtail.blocks.StructBlock([('text', wagtail.blocks.TextBlock()), ('attribute_name', wagtail.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))])), ('embed_block', wagtail.embeds.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, use_json_field=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/blog/models.py b/bakerydemo/blog/models.py index e98953c..46f6a6b 100644 --- a/bakerydemo/blog/models.py +++ b/bakerydemo/blog/models.py @@ -66,7 +66,7 @@ class BlogPage(Page): help_text='Landscape mode only; horizontal width between 1000px and 3000px.' ) body = StreamField( - BaseStreamBlock(), verbose_name="Page body", blank=True + BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True ) subtitle = models.CharField(blank=True, max_length=255) tags = ClusterTaggableManager(through=BlogPageTag, blank=True) diff --git a/bakerydemo/breads/migrations/0004_use_json_field_for_body_streamfield.py b/bakerydemo/breads/migrations/0004_use_json_field_for_body_streamfield.py new file mode 100644 index 0000000..c6d2b6a --- /dev/null +++ b/bakerydemo/breads/migrations/0004_use_json_field_for_body_streamfield.py @@ -0,0 +1,22 @@ +# Generated by Django 4.0.5 on 2022-06-15 10:49 + +from django.db import migrations +import wagtail.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('breads', '0003_auto_20170329_0055'), + ] + + operations = [ + migrations.AlterField( + model_name='breadpage', + name='body', + field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph_block', wagtail.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('block_quote', wagtail.blocks.StructBlock([('text', wagtail.blocks.TextBlock()), ('attribute_name', wagtail.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))])), ('embed_block', wagtail.embeds.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, use_json_field=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/breads/models.py b/bakerydemo/breads/models.py index 243df2b..c828238 100644 --- a/bakerydemo/breads/models.py +++ b/bakerydemo/breads/models.py @@ -98,7 +98,7 @@ class BreadPage(Page): help_text='Landscape mode only; horizontal width between 1000px and 3000px.' ) body = StreamField( - BaseStreamBlock(), verbose_name="Page body", blank=True + BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True ) origin = models.ForeignKey( Country, diff --git a/bakerydemo/locations/migrations/0005_use_json_field_for_body_streamfield.py b/bakerydemo/locations/migrations/0005_use_json_field_for_body_streamfield.py new file mode 100644 index 0000000..0fcfedc --- /dev/null +++ b/bakerydemo/locations/migrations/0005_use_json_field_for_body_streamfield.py @@ -0,0 +1,22 @@ +# Generated by Django 4.0.5 on 2022-06-15 10:49 + +from django.db import migrations +import wagtail.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0004_auto_20190912_1149'), + ] + + operations = [ + migrations.AlterField( + model_name='locationpage', + name='body', + field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph_block', wagtail.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('block_quote', wagtail.blocks.StructBlock([('text', wagtail.blocks.TextBlock()), ('attribute_name', wagtail.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))])), ('embed_block', wagtail.embeds.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, use_json_field=True, verbose_name='Page body'), + ), + ] diff --git a/bakerydemo/locations/models.py b/bakerydemo/locations/models.py index 9744bdb..1cb2cf4 100644 --- a/bakerydemo/locations/models.py +++ b/bakerydemo/locations/models.py @@ -139,7 +139,7 @@ class LocationPage(Page): help_text='Landscape mode only; horizontal width between 1000px and 3000px.' ) body = StreamField( - BaseStreamBlock(), verbose_name="Page body", blank=True + BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True ) address = models.TextField() lat_long = models.CharField(