Matt Westcott 2 年之前
父节点
当前提交
6d8c364115

+ 206 - 57
bakerydemo/base/migrations/0009_auto_20220823_1659.py

@@ -9,100 +9,249 @@ import wagtail_editable_help.models
 class Migration(migrations.Migration):
 class Migration(migrations.Migration):
 
 
     dependencies = [
     dependencies = [
-        ('wagtailcore', '0040_page_draft_title'),
+        ("wagtailcore", "0040_page_draft_title"),
-        ('wagtailimages', '0024_index_image_file_hash'),
+        ("wagtailimages", "0024_index_image_file_hash"),
-        ('base', '0008_use_json_field_for_body_streamfield'),
+        ("base", "0008_use_json_field_for_body_streamfield"),
     ]
     ]
 
 
     operations = [
     operations = [
         migrations.AlterField(
         migrations.AlterField(
-            model_name='gallerypage',
+            model_name="gallerypage",
-            name='collection',
+            name="collection",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Gallery page collection', default='Select the image collection for this gallery.'), limit_choices_to=models.Q(('name__in', ['Root']), _negated=True), null=True, on_delete=django.db.models.deletion.SET_NULL, to='wagtailcore.collection'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Gallery page collection",
+                    default="Select the image collection for this gallery.",
+                ),
+                limit_choices_to=models.Q(("name__in", ["Root"]), _negated=True),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                to="wagtailcore.collection",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='gallerypage',
+            model_name="gallerypage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='gallerypage',
+            model_name="gallerypage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Gallery page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Gallery page introduction", default="Text to describe the page"
+                ),
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='featured_section_1',
+            name="featured_section_1",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page featured section 1', default='First featured section for the homepage. Will display up to three child items.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.page', verbose_name='Featured section 1'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page featured section 1",
+                    default="First featured section for the homepage. Will display up to three child items.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailcore.page",
+                verbose_name="Featured section 1",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='featured_section_1_title',
+            name="featured_section_1_title",
-            field=models.CharField(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page featured section title 1', default='Title to display above the promo copy'), max_length=255),
+            field=models.CharField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page featured section title 1",
+                    default="Title to display above the promo copy",
+                ),
+                max_length=255,
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='featured_section_2',
+            name="featured_section_2",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page featured section 2', default='Second featured section for the homepage. Will display up to three child items.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.page', verbose_name='Featured section 2'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page featured section 2",
+                    default="Second featured section for the homepage. Will display up to three child items.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailcore.page",
+                verbose_name="Featured section 2",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='featured_section_2_title',
+            name="featured_section_2_title",
-            field=models.CharField(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page featured section title 2', default='Title to display above the promo copy'), max_length=255),
+            field=models.CharField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page featured section title 2",
+                    default="Title to display above the promo copy",
+                ),
+                max_length=255,
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='featured_section_3',
+            name="featured_section_3",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page featured section 3', default='Third featured section for the homepage. Will display up to six child items.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.page', verbose_name='Featured section 3'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page featured section 3",
+                    default="Third featured section for the homepage. Will display up to six child items.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailcore.page",
+                verbose_name="Featured section 3",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='featured_section_3_title',
+            name="featured_section_3_title",
-            field=models.CharField(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page featured section title 3', default='Title to display above the promo copy'), max_length=255),
+            field=models.CharField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page featured section title 3",
+                    default="Title to display above the promo copy",
+                ),
+                max_length=255,
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='hero_cta',
+            name="hero_cta",
-            field=models.CharField(help_text=wagtail_editable_help.models.HelpText('Home page hero CTA', default='Text to display on Call to Action'), max_length=255, verbose_name='Hero CTA'),
+            field=models.CharField(
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page hero CTA", default="Text to display on Call to Action"
+                ),
+                max_length=255,
+                verbose_name="Hero CTA",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='hero_cta_link',
+            name="hero_cta_link",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page CTA link', default='Choose a page to link to for the Call to Action'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.page', verbose_name='Hero CTA link'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page CTA link",
+                    default="Choose a page to link to for the Call to Action",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailcore.page",
+                verbose_name="Hero CTA link",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='hero_text',
+            name="hero_text",
-            field=models.CharField(help_text=wagtail_editable_help.models.HelpText('Home page hero text', default='Write an introduction for the bakery'), max_length=255),
+            field=models.CharField(
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page hero text",
+                    default="Write an introduction for the bakery",
+                ),
+                max_length=255,
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='promo_image',
+            name="promo_image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page promo image', default='Promo image'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page promo image", default="Promo image"
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='promo_text',
+            name="promo_text",
-            field=wagtail.fields.RichTextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page promo text', default='Write some promotional copy'), null=True),
+            field=wagtail.fields.RichTextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page promo text", default="Write some promotional copy"
+                ),
+                null=True,
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='homepage',
+            model_name="homepage",
-            name='promo_title',
+            name="promo_title",
-            field=models.CharField(blank=True, help_text=wagtail_editable_help.models.HelpText('Home page promo title', default='Title to display above the promo copy'), max_length=255),
+            field=models.CharField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Home page promo title",
+                    default="Title to display above the promo copy",
+                ),
+                max_length=255,
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='standardpage',
+            model_name="standardpage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='standardpage',
+            model_name="standardpage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Standard page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Standard page introduction", default="Text to describe the page"
+                ),
+            ),
         ),
         ),
     ]
     ]

+ 65 - 24
bakerydemo/base/models.py

@@ -9,7 +9,6 @@ from wagtail.fields import RichTextField, StreamField
 from wagtail.models import Collection, Page
 from wagtail.models import Collection, Page
 from wagtail.search import index
 from wagtail.search import index
 from wagtail.snippets.models import register_snippet
 from wagtail.snippets.models import register_snippet
-
 from wagtail_editable_help.models import HelpText
 from wagtail_editable_help.models import HelpText
 
 
 from .blocks import BaseStreamBlock
 from .blocks import BaseStreamBlock
@@ -110,7 +109,9 @@ class StandardPage(Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Standard page introduction", default="Text to describe the page"),
+        help_text=HelpText(
+            "Standard page introduction", default="Text to describe the page"
+        ),
         blank=True,
         blank=True,
     )
     )
     image = models.ForeignKey(
     image = models.ForeignKey(
@@ -119,7 +120,10 @@ class StandardPage(Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
     body = StreamField(
     body = StreamField(
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
@@ -149,16 +153,23 @@ class HomePage(Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
     hero_text = models.CharField(
     hero_text = models.CharField(
         max_length=255,
         max_length=255,
-        help_text=HelpText("Home page hero text", default="Write an introduction for the bakery"),
+        help_text=HelpText(
+            "Home page hero text", default="Write an introduction for the bakery"
+        ),
     )
     )
     hero_cta = models.CharField(
     hero_cta = models.CharField(
         verbose_name="Hero CTA",
         verbose_name="Hero CTA",
         max_length=255,
         max_length=255,
-        help_text=HelpText("Home page hero CTA", default="Text to display on Call to Action"),
+        help_text=HelpText(
+            "Home page hero CTA", default="Text to display on Call to Action"
+        ),
     )
     )
     hero_cta_link = models.ForeignKey(
     hero_cta_link = models.ForeignKey(
         "wagtailcore.Page",
         "wagtailcore.Page",
@@ -167,7 +178,10 @@ class HomePage(Page):
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
         verbose_name="Hero CTA link",
         verbose_name="Hero CTA link",
-        help_text=HelpText("Home page CTA link", default="Choose a page to link to for the Call to Action"),
+        help_text=HelpText(
+            "Home page CTA link",
+            default="Choose a page to link to for the Call to Action",
+        ),
     )
     )
 
 
     # Body section of the HomePage
     # Body section of the HomePage
@@ -188,12 +202,18 @@ class HomePage(Page):
         help_text=HelpText("Home page promo image", default="Promo image"),
         help_text=HelpText("Home page promo image", default="Promo image"),
     )
     )
     promo_title = models.CharField(
     promo_title = models.CharField(
-        blank=True, max_length=255,
+        blank=True,
-        help_text=HelpText("Home page promo title", default="Title to display above the promo copy"),
+        max_length=255,
+        help_text=HelpText(
+            "Home page promo title", default="Title to display above the promo copy"
+        ),
     )
     )
     promo_text = RichTextField(
     promo_text = RichTextField(
-        null=True, blank=True,
+        null=True,
-        help_text=HelpText("Home page promo text", default="Write some promotional copy"),
+        blank=True,
+        help_text=HelpText(
+            "Home page promo text", default="Write some promotional copy"
+        ),
     )
     )
 
 
     # Featured sections on the HomePage
     # Featured sections on the HomePage
@@ -202,8 +222,12 @@ class HomePage(Page):
     # Each list their children items that we access via the children function
     # Each list their children items that we access via the children function
     # that we define on the individual Page models e.g. BlogIndexPage
     # that we define on the individual Page models e.g. BlogIndexPage
     featured_section_1_title = models.CharField(
     featured_section_1_title = models.CharField(
-        blank=True, max_length=255,
+        blank=True,
-        help_text=HelpText("Home page featured section title 1", default="Title to display above the promo copy"),
+        max_length=255,
+        help_text=HelpText(
+            "Home page featured section title 1",
+            default="Title to display above the promo copy",
+        ),
     )
     )
     featured_section_1 = models.ForeignKey(
     featured_section_1 = models.ForeignKey(
         "wagtailcore.Page",
         "wagtailcore.Page",
@@ -213,14 +237,18 @@ class HomePage(Page):
         related_name="+",
         related_name="+",
         help_text=HelpText(
         help_text=HelpText(
             "Home page featured section 1",
             "Home page featured section 1",
-            default="First featured section for the homepage. Will display up to three child items."
+            default="First featured section for the homepage. Will display up to three child items.",
         ),
         ),
         verbose_name="Featured section 1",
         verbose_name="Featured section 1",
     )
     )
 
 
     featured_section_2_title = models.CharField(
     featured_section_2_title = models.CharField(
-        blank=True, max_length=255,
+        blank=True,
-        help_text=HelpText("Home page featured section title 2", default="Title to display above the promo copy"),
+        max_length=255,
+        help_text=HelpText(
+            "Home page featured section title 2",
+            default="Title to display above the promo copy",
+        ),
     )
     )
     featured_section_2 = models.ForeignKey(
     featured_section_2 = models.ForeignKey(
         "wagtailcore.Page",
         "wagtailcore.Page",
@@ -230,14 +258,18 @@ class HomePage(Page):
         related_name="+",
         related_name="+",
         help_text=HelpText(
         help_text=HelpText(
             "Home page featured section 2",
             "Home page featured section 2",
-            default="Second featured section for the homepage. Will display up to three child items."
+            default="Second featured section for the homepage. Will display up to three child items.",
         ),
         ),
         verbose_name="Featured section 2",
         verbose_name="Featured section 2",
     )
     )
 
 
     featured_section_3_title = models.CharField(
     featured_section_3_title = models.CharField(
-        blank=True, max_length=255,
+        blank=True,
-        help_text=HelpText("Home page featured section title 3", default="Title to display above the promo copy"),
+        max_length=255,
+        help_text=HelpText(
+            "Home page featured section title 3",
+            default="Title to display above the promo copy",
+        ),
     )
     )
     featured_section_3 = models.ForeignKey(
     featured_section_3 = models.ForeignKey(
         "wagtailcore.Page",
         "wagtailcore.Page",
@@ -247,7 +279,7 @@ class HomePage(Page):
         related_name="+",
         related_name="+",
         help_text=HelpText(
         help_text=HelpText(
             "Home page featured section 3",
             "Home page featured section 3",
-            default="Third featured section for the homepage. Will display up to six child items."
+            default="Third featured section for the homepage. Will display up to six child items.",
         ),
         ),
         verbose_name="Featured section 3",
         verbose_name="Featured section 3",
     )
     )
@@ -314,15 +346,21 @@ class GalleryPage(Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Gallery page introduction", default="Text to describe the page"),
+        help_text=HelpText(
-        blank=True)
+            "Gallery page introduction", default="Text to describe the page"
+        ),
+        blank=True,
+    )
     image = models.ForeignKey(
     image = models.ForeignKey(
         "wagtailimages.Image",
         "wagtailimages.Image",
         null=True,
         null=True,
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
     body = StreamField(
     body = StreamField(
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
@@ -333,7 +371,10 @@ class GalleryPage(Page):
         null=True,
         null=True,
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
-        help_text=HelpText("Gallery page collection", default="Select the image collection for this gallery."),
+        help_text=HelpText(
+            "Gallery page collection",
+            default="Select the image collection for this gallery.",
+        ),
     )
     )
 
 
     content_panels = Page.content_panels + [
     content_panels = Page.content_panels + [

+ 44 - 14
bakerydemo/blog/migrations/0006_auto_20220823_1659.py

@@ -8,29 +8,59 @@ import wagtail_editable_help.models
 class Migration(migrations.Migration):
 class Migration(migrations.Migration):
 
 
     dependencies = [
     dependencies = [
-        ('wagtailimages', '0024_index_image_file_hash'),
+        ("wagtailimages", "0024_index_image_file_hash"),
-        ('blog', '0005_use_json_field_for_body_streamfield'),
+        ("blog", "0005_use_json_field_for_body_streamfield"),
     ]
     ]
 
 
     operations = [
     operations = [
         migrations.AlterField(
         migrations.AlterField(
-            model_name='blogindexpage',
+            model_name="blogindexpage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='blogindexpage',
+            model_name="blogindexpage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Blog index page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Blog index page introduction", default="Text to describe the page"
+                ),
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='blogpage',
+            model_name="blogpage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='blogpage',
+            model_name="blogpage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Blog page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Blog page introduction", default="Text to describe the page"
+                ),
+            ),
         ),
         ),
     ]
     ]

+ 15 - 6
bakerydemo/blog/models.py

@@ -11,7 +11,6 @@ from wagtail.contrib.routable_page.models import RoutablePageMixin, route
 from wagtail.fields import StreamField
 from wagtail.fields import StreamField
 from wagtail.models import Orderable, Page
 from wagtail.models import Orderable, Page
 from wagtail.search import index
 from wagtail.search import index
-
 from wagtail_editable_help.models import HelpText
 from wagtail_editable_help.models import HelpText
 
 
 from bakerydemo.base.blocks import BaseStreamBlock
 from bakerydemo.base.blocks import BaseStreamBlock
@@ -57,7 +56,9 @@ class BlogPage(Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Blog page introduction", default="Text to describe the page"),
+        help_text=HelpText(
+            "Blog page introduction", default="Text to describe the page"
+        ),
         blank=True,
         blank=True,
     )
     )
     image = models.ForeignKey(
     image = models.ForeignKey(
@@ -66,7 +67,10 @@ class BlogPage(Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
     body = StreamField(
     body = StreamField(
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
@@ -136,8 +140,10 @@ class BlogIndexPage(RoutablePageMixin, Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Blog index page introduction", default="Text to describe the page"),
+        help_text=HelpText(
-        blank=True
+            "Blog index page introduction", default="Text to describe the page"
+        ),
+        blank=True,
     )
     )
     image = models.ForeignKey(
     image = models.ForeignKey(
         "wagtailimages.Image",
         "wagtailimages.Image",
@@ -145,7 +151,10 @@ class BlogIndexPage(RoutablePageMixin, Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
 
 
     content_panels = Page.content_panels + [
     content_panels = Page.content_panels + [

+ 45 - 14
bakerydemo/breads/migrations/0005_auto_20220823_1659.py

@@ -8,29 +8,60 @@ import wagtail_editable_help.models
 class Migration(migrations.Migration):
 class Migration(migrations.Migration):
 
 
     dependencies = [
     dependencies = [
-        ('wagtailimages', '0024_index_image_file_hash'),
+        ("wagtailimages", "0024_index_image_file_hash"),
-        ('breads', '0004_use_json_field_for_body_streamfield'),
+        ("breads", "0004_use_json_field_for_body_streamfield"),
     ]
     ]
 
 
     operations = [
     operations = [
         migrations.AlterField(
         migrations.AlterField(
-            model_name='breadpage',
+            model_name="breadpage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='breadpage',
+            model_name="breadpage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Bread page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Bread page introduction", default="Text to describe the page"
+                ),
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='breadsindexpage',
+            model_name="breadsindexpage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='breadsindexpage',
+            model_name="breadsindexpage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Breads index page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Breads index page introduction",
+                    default="Text to describe the page",
+                ),
+            ),
         ),
         ),
     ]
     ]

+ 15 - 6
bakerydemo/breads/models.py

@@ -7,7 +7,6 @@ from wagtail.fields import StreamField
 from wagtail.models import Page
 from wagtail.models import Page
 from wagtail.search import index
 from wagtail.search import index
 from wagtail.snippets.models import register_snippet
 from wagtail.snippets.models import register_snippet
-
 from wagtail_editable_help.models import HelpText
 from wagtail_editable_help.models import HelpText
 
 
 from bakerydemo.base.blocks import BaseStreamBlock
 from bakerydemo.base.blocks import BaseStreamBlock
@@ -87,8 +86,10 @@ class BreadPage(Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Bread page introduction", default="Text to describe the page"),
+        help_text=HelpText(
-        blank=True
+            "Bread page introduction", default="Text to describe the page"
+        ),
+        blank=True,
     )
     )
     image = models.ForeignKey(
     image = models.ForeignKey(
         "wagtailimages.Image",
         "wagtailimages.Image",
@@ -96,7 +97,10 @@ class BreadPage(Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
     body = StreamField(
     body = StreamField(
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
@@ -157,7 +161,9 @@ class BreadsIndexPage(Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Breads index page introduction", default="Text to describe the page"),
+        help_text=HelpText(
+            "Breads index page introduction", default="Text to describe the page"
+        ),
         blank=True,
         blank=True,
     )
     )
     image = models.ForeignKey(
     image = models.ForeignKey(
@@ -166,7 +172,10 @@ class BreadsIndexPage(Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
 
 
     content_panels = Page.content_panels + [
     content_panels = Page.content_panels + [

+ 71 - 20
bakerydemo/locations/migrations/0006_auto_20220823_1659.py

@@ -9,39 +9,90 @@ import wagtail_editable_help.models
 class Migration(migrations.Migration):
 class Migration(migrations.Migration):
 
 
     dependencies = [
     dependencies = [
-        ('wagtailimages', '0024_index_image_file_hash'),
+        ("wagtailimages", "0024_index_image_file_hash"),
-        ('locations', '0005_use_json_field_for_body_streamfield'),
+        ("locations", "0005_use_json_field_for_body_streamfield"),
     ]
     ]
 
 
     operations = [
     operations = [
         migrations.AlterField(
         migrations.AlterField(
-            model_name='locationoperatinghours',
+            model_name="locationoperatinghours",
-            name='closed',
+            name="closed",
-            field=models.BooleanField(blank=True, help_text=wagtail_editable_help.models.HelpText('Operating hours closed', default='Tick if location is closed on this day'), verbose_name='Closed?'),
+            field=models.BooleanField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Operating hours closed",
+                    default="Tick if location is closed on this day",
+                ),
+                verbose_name="Closed?",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='locationpage',
+            model_name="locationpage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='locationpage',
+            model_name="locationpage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Location page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Location page introduction", default="Text to describe the page"
+                ),
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='locationpage',
+            model_name="locationpage",
-            name='lat_long',
+            name="lat_long",
-            field=models.CharField(help_text=wagtail_editable_help.models.HelpText('Location page lat/long', default="Comma separated lat/long. (Ex. 64.144367, -21.939182) Right click Google Maps and select 'What's Here'"), max_length=36, validators=[django.core.validators.RegexValidator(code='invalid_lat_long', message='Lat Long must be a comma-separated numeric lat and long', regex='^(\\-?\\d+(\\.\\d+)?),\\s*(\\-?\\d+(\\.\\d+)?)$')]),
+            field=models.CharField(
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Location page lat/long",
+                    default="Comma separated lat/long. (Ex. 64.144367, -21.939182) Right click Google Maps and select 'What's Here'",
+                ),
+                max_length=36,
+                validators=[
+                    django.core.validators.RegexValidator(
+                        code="invalid_lat_long",
+                        message="Lat Long must be a comma-separated numeric lat and long",
+                        regex="^(\\-?\\d+(\\.\\d+)?),\\s*(\\-?\\d+(\\.\\d+)?)$",
+                    )
+                ],
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='locationsindexpage',
+            model_name="locationsindexpage",
-            name='image',
+            name="image",
-            field=models.ForeignKey(blank=True, help_text=wagtail_editable_help.models.HelpText('Hero image', default='Landscape mode only; horizontal width between 1000px and 3000px.'), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
+            field=models.ForeignKey(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Hero image",
+                    default="Landscape mode only; horizontal width between 1000px and 3000px.",
+                ),
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                related_name="+",
+                to="wagtailimages.image",
+            ),
         ),
         ),
         migrations.AlterField(
         migrations.AlterField(
-            model_name='locationsindexpage',
+            model_name="locationsindexpage",
-            name='introduction',
+            name="introduction",
-            field=models.TextField(blank=True, help_text=wagtail_editable_help.models.HelpText('Locations index page introduction', default='Text to describe the page')),
+            field=models.TextField(
+                blank=True,
+                help_text=wagtail_editable_help.models.HelpText(
+                    "Locations index page introduction",
+                    default="Text to describe the page",
+                ),
+            ),
         ),
         ),
     ]
     ]

+ 20 - 8
bakerydemo/locations/models.py

@@ -8,7 +8,6 @@ from wagtail.admin.panels import FieldPanel, InlinePanel
 from wagtail.fields import StreamField
 from wagtail.fields import StreamField
 from wagtail.models import Orderable, Page
 from wagtail.models import Orderable, Page
 from wagtail.search import index
 from wagtail.search import index
-
 from wagtail_editable_help.models import HelpText
 from wagtail_editable_help.models import HelpText
 
 
 from bakerydemo.base.blocks import BaseStreamBlock
 from bakerydemo.base.blocks import BaseStreamBlock
@@ -24,8 +23,11 @@ class OperatingHours(models.Model):
     opening_time = models.TimeField(blank=True, null=True)
     opening_time = models.TimeField(blank=True, null=True)
     closing_time = models.TimeField(blank=True, null=True)
     closing_time = models.TimeField(blank=True, null=True)
     closed = models.BooleanField(
     closed = models.BooleanField(
-        "Closed?", blank=True,
+        "Closed?",
-        help_text=HelpText("Operating hours closed", default="Tick if location is closed on this day"),
+        blank=True,
+        help_text=HelpText(
+            "Operating hours closed", default="Tick if location is closed on this day"
+        ),
     )
     )
 
 
     panels = [
     panels = [
@@ -71,7 +73,9 @@ class LocationsIndexPage(Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Locations index page introduction", default="Text to describe the page"),
+        help_text=HelpText(
+            "Locations index page introduction", default="Text to describe the page"
+        ),
         blank=True,
         blank=True,
     )
     )
     image = models.ForeignKey(
     image = models.ForeignKey(
@@ -80,7 +84,10 @@ class LocationsIndexPage(Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
 
 
     # Only LocationPage objects can be added underneath this index page
     # Only LocationPage objects can be added underneath this index page
@@ -114,8 +121,10 @@ class LocationPage(Page):
     """
     """
 
 
     introduction = models.TextField(
     introduction = models.TextField(
-        help_text=HelpText("Location page introduction", default="Text to describe the page"),
+        help_text=HelpText(
-        blank=True
+            "Location page introduction", default="Text to describe the page"
+        ),
+        blank=True,
     )
     )
     image = models.ForeignKey(
     image = models.ForeignKey(
         "wagtailimages.Image",
         "wagtailimages.Image",
@@ -123,7 +132,10 @@ class LocationPage(Page):
         blank=True,
         blank=True,
         on_delete=models.SET_NULL,
         on_delete=models.SET_NULL,
         related_name="+",
         related_name="+",
-        help_text=HelpText("Hero image", default="Landscape mode only; horizontal width between 1000px and 3000px."),
+        help_text=HelpText(
+            "Hero image",
+            default="Landscape mode only; horizontal width between 1000px and 3000px.",
+        ),
     )
     )
     body = StreamField(
     body = StreamField(
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True
         BaseStreamBlock(), verbose_name="Page body", blank=True, use_json_field=True