diff --git a/bakerydemo/base/blocks.py b/bakerydemo/base/blocks.py index a2ea29646..93dd330d2 100644 --- a/bakerydemo/base/blocks.py +++ b/bakerydemo/base/blocks.py @@ -7,22 +7,22 @@ TextBlock, ) from wagtail.embeds.blocks import EmbedBlock -from wagtail.images.blocks import ImageChooserBlock +from wagtail.images.blocks import ImageBlock -class ImageBlock(StructBlock): +class CaptionedImageBlock(StructBlock): """ Custom `StructBlock` for utilizing images with associated caption and attribution data """ - image = ImageChooserBlock(required=True) + image = ImageBlock(required=True) caption = CharBlock(required=False) attribution = CharBlock(required=False) class Meta: icon = "image" - template = "blocks/image_block.html" + template = "blocks/captioned_image_block.html" class HeadingBlock(StructBlock): diff --git a/bakerydemo/base/fixtures/bakerydemo.json b/bakerydemo/base/fixtures/bakerydemo.json index ae3def2b5..ab245d2b7 100644 --- a/bakerydemo/base/fixtures/bakerydemo.json +++ b/bakerydemo/base/fixtures/bakerydemo.json @@ -245,14 +245,6 @@ "content_object": 73 } }, - { - "model": "blog.blogpagetag", - "pk": 97, - "fields": { - "tag": 11, - "content_object": 77 - } - }, { "model": "blog.blogpagetag", "pk": 98, @@ -277,6 +269,14 @@ "content_object": 68 } }, + { + "model": "blog.blogpagetag", + "pk": 101, + "fields": { + "tag": 11, + "content_object": 77 + } + }, { "model": "breads.country", "pk": 1, @@ -1245,54 +1245,6 @@ "cache_until": null } }, - { - "model": "wagtailsearchpromotions.query", - "pk": 1, - "fields": { - "query_string": "chocolate" - } - }, - { - "model": "wagtailsearchpromotions.query", - "pk": 2, - "fields": { - "query_string": "london" - } - }, - { - "model": "wagtailsearchpromotions.query", - "pk": 3, - "fields": { - "query_string": "circus" - } - }, - { - "model": "wagtailsearchpromotions.querydailyhits", - "pk": 1, - "fields": { - "query": 1, - "date": "2019-02-11", - "hits": 2 - } - }, - { - "model": "wagtailsearchpromotions.querydailyhits", - "pk": 2, - "fields": { - "query": 2, - "date": "2019-02-15", - "hits": 1 - } - }, - { - "model": "wagtailsearchpromotions.querydailyhits", - "pk": 3, - "fields": { - "query": 3, - "date": "2019-02-24", - "hits": 1 - } - }, { "model": "wagtailforms.formsubmission", "pk": 1, @@ -1403,8 +1355,10 @@ "fields": { "query": 1, "page": 63, - "sort_order": 0, - "description": "" + "external_link_url": "", + "external_link_text": null, + "description": "", + "sort_order": 0 } }, { @@ -1413,8 +1367,10 @@ "fields": { "query": 4, "page": 40, - "sort_order": 0, - "description": "" + "external_link_url": "", + "external_link_text": null, + "description": "", + "sort_order": 0 } }, { @@ -1423,8 +1379,10 @@ "fields": { "query": 5, "page": 36, - "sort_order": 0, - "description": "" + "external_link_url": "", + "external_link_text": null, + "description": "", + "sort_order": 0 } }, { @@ -1523,6 +1481,13 @@ "workflow": 1 } }, + { + "model": "wagtailcore.workflowcontenttype", + "pk": 26, + "fields": { + "workflow": 1 + } + }, { "model": "wagtailcore.workflowtask", "pk": 1, @@ -1697,7 +1662,7 @@ "pk": 3, "fields": { "password": "pbkdf2_sha256$600000$yzcRrbI8n9Yfwg8S9T0nZt$4bZz0FcUIq/zFOU6XDrb31HxAFnsHqoqyR/CCSevqmE=", - "last_login": "2023-09-01T17:55:27.917Z", + "last_login": "2024-08-06T07:39:15.322Z", "is_superuser": true, "username": "admin", "first_name": "Admin", @@ -3845,6 +3810,57 @@ "page": 68 } }, + { + "model": "wagtailcore.pagelogentry", + "pk": 116, + "fields": { + "content_type": ["blog", "blogpage"], + "label": "Desserts with Benefits", + "action": "wagtail.edit", + "data": {}, + "timestamp": "2024-08-06T07:43:35.710Z", + "uuid": "c3034340-74b5-4df4-a5c0-db63b0962606", + "user": ["admin"], + "revision": 112, + "content_changed": true, + "deleted": false, + "page": 77 + } + }, + { + "model": "wagtailcore.pagelogentry", + "pk": 117, + "fields": { + "content_type": ["blog", "blogpage"], + "label": "Desserts with Benefits", + "action": "wagtail.edit", + "data": {}, + "timestamp": "2024-08-06T07:43:40.310Z", + "uuid": "b21d1f51-5ffc-473b-901e-6901ef56fc3a", + "user": ["admin"], + "revision": 113, + "content_changed": true, + "deleted": false, + "page": 77 + } + }, + { + "model": "wagtailcore.pagelogentry", + "pk": 118, + "fields": { + "content_type": ["blog", "blogpage"], + "label": "Desserts with Benefits", + "action": "wagtail.publish", + "data": {}, + "timestamp": "2024-08-06T07:43:40.361Z", + "uuid": "b21d1f51-5ffc-473b-901e-6901ef56fc3a", + "user": ["admin"], + "revision": 113, + "content_changed": false, + "deleted": false, + "page": 77 + } + }, { "model": "wagtailcore.taskstate", "pk": 1, @@ -9888,6 +9904,136 @@ "approved_go_live_at": null } }, + { + "model": "wagtailcore.revision", + "pk": 112, + "fields": { + "content_type": ["blog", "blogpage"], + "base_content_type": ["wagtailcore", "page"], + "object_id": "77", + "created_at": "2024-08-06T07:43:35.670Z", + "user": ["admin"], + "object_str": "Desserts with Benefits", + "content": { + "pk": 77, + "path": "0001000200040006", + "depth": 4, + "numchild": 0, + "translation_key": "bef97199-e97c-425b-90b3-f4d606db810c", + "locale": 1, + "latest_revision": 54, + "live": true, + "has_unpublished_changes": false, + "first_published_at": "2019-03-22T06:31:05.324Z", + "last_published_at": "2023-09-01T16:55:14.519Z", + "live_revision": 54, + "go_live_at": null, + "expire_at": null, + "expired": false, + "locked": false, + "locked_at": null, + "locked_by": null, + "title": "Desserts with Benefits", + "draft_title": "Desserts with Benefits", + "slug": "desserts-benefits", + "content_type": 40, + "url_path": "/home/blog/desserts-benefits/", + "owner": 3, + "seo_title": "", + "show_in_menus": false, + "search_description": "", + "latest_revision_created_at": "2023-09-01T16:55:14.481Z", + "alias_of": null, + "introduction": "A Boston cream pie is a yellow butter cake that is filled with custard or cream and topped with chocolate glaze.", + "image": 43, + "body": "[{\"type\": \"paragraph_block\", \"value\": \"

Despite its name, it is in fact a cake, and not a pie.[2] The dessert acquired its name when cakes and pies were cooked in the same pans, and the words were used interchangeably.[3] In the latter part of the 19th century, this type of cake was variously called a \\\"cream pie\\\", a \\\"chocolate cream pie\\\", or a \\\"custard cake\\\".[3]

Owners of the Parker House Hotel in Boston claim that the Boston cream pie was first created at the hotel by Armenian-French chef M. Sanzian in 1856.[4] Called a \\\"Chocolate Cream Pie\\\", this cake consisted of two layers of French butter sponge cake filled with cr\\u00e8me p\\u00e2tissi\\u00e8re and brushed with a rum syrup, its side coated with cr\\u00e8me p\\u00e2tissi\\u00e8re overlain with toasted sliced almonds, and the top coated with chocolate fondant.[5] However, historians dispute this claim to primacy; while this cake may have been served then, there is no specific contemporaneous evidence of it, and custard-filled cake was already popular at that time.[3]

\", \"id\": \"b793eb57-cf99-4c2e-abc5-e3d5a8ea486b\"}, {\"type\": \"image_block\", \"value\": {\"image\": 15, \"alt_text\": \"A freshly baked artisan bread with a golden-brown crust and a rounded shape, cooling on a wire rack\", \"decorative\": false}, \"id\": \"556e76b0-0f5a-42bb-b039-653f3d6b1f0b\"}, {\"type\": \"paragraph_block\", \"value\": \"

The cake is likely derived from the Washington pie, a two-layer yellow cake filled with jam and topped with confectioner's sugar, for which pastry cream of custard eventually replaced the jam, and a chocolate glaze replaced the confectioner's sugar.[2] Today, the cake is topped with a chocolate glaze (such as ganache) and sometimes powdered sugar or a cherry.

The name first appeared in the 1872 Methodist Almanac.[3] Another early printed use of the term \\\"Boston cream pie\\\" occurred in the Granite Iron Ware Cook Book, printed in 1878.[2] The earliest known recipe of the modern variant was printed in Miss Parloa's Kitchen Companion in 1887 as \\\"Chocolate Cream Pie\\\".[2]

And on another note, here are cookies baking in the oven:

\", \"id\": \"ac48af95-b3be-4602-8c2f-5c43fc080f17\"}]", + "subtitle": "Banana toffee chocolate pie?", + "date_published": "2019-02-24", + "wagtail_admin_comments": [], + "blog_person_relationship": [ + { + "pk": 9, + "sort_order": 0, + "page": 77, + "person": 2 + } + ], + "tagged_items": [ + { + "pk": null, + "tag": 11, + "content_object": 77 + } + ] + }, + "approved_go_live_at": null + } + }, + { + "model": "wagtailcore.revision", + "pk": 113, + "fields": { + "content_type": ["blog", "blogpage"], + "base_content_type": ["wagtailcore", "page"], + "object_id": "77", + "created_at": "2024-08-06T07:43:40.293Z", + "user": ["admin"], + "object_str": "Desserts with Benefits", + "content": { + "pk": 77, + "path": "0001000200040006", + "depth": 4, + "numchild": 0, + "translation_key": "bef97199-e97c-425b-90b3-f4d606db810c", + "locale": 1, + "latest_revision": 112, + "live": true, + "has_unpublished_changes": true, + "first_published_at": "2019-03-22T06:31:05.324Z", + "last_published_at": "2023-09-01T16:55:14.519Z", + "live_revision": 54, + "go_live_at": null, + "expire_at": null, + "expired": false, + "locked": false, + "locked_at": null, + "locked_by": null, + "title": "Desserts with Benefits", + "draft_title": "Desserts with Benefits", + "slug": "desserts-benefits", + "content_type": 40, + "url_path": "/home/blog/desserts-benefits/", + "owner": 3, + "seo_title": "", + "show_in_menus": false, + "search_description": "", + "latest_revision_created_at": "2024-08-06T07:43:35.670Z", + "alias_of": null, + "introduction": "A Boston cream pie is a yellow butter cake that is filled with custard or cream and topped with chocolate glaze.", + "image": 43, + "body": "[{\"type\": \"paragraph_block\", \"value\": \"

Despite its name, it is in fact a cake, and not a pie.[2] The dessert acquired its name when cakes and pies were cooked in the same pans, and the words were used interchangeably.[3] In the latter part of the 19th century, this type of cake was variously called a \\\"cream pie\\\", a \\\"chocolate cream pie\\\", or a \\\"custard cake\\\".[3]

Owners of the Parker House Hotel in Boston claim that the Boston cream pie was first created at the hotel by Armenian-French chef M. Sanzian in 1856.[4] Called a \\\"Chocolate Cream Pie\\\", this cake consisted of two layers of French butter sponge cake filled with cr\\u00e8me p\\u00e2tissi\\u00e8re and brushed with a rum syrup, its side coated with cr\\u00e8me p\\u00e2tissi\\u00e8re overlain with toasted sliced almonds, and the top coated with chocolate fondant.[5] However, historians dispute this claim to primacy; while this cake may have been served then, there is no specific contemporaneous evidence of it, and custard-filled cake was already popular at that time.[3]

\", \"id\": \"b793eb57-cf99-4c2e-abc5-e3d5a8ea486b\"}, {\"type\": \"image_block\", \"value\": {\"image\": 15, \"alt_text\": \"A freshly baked artisan bread with a golden-brown crust and a rounded shape, cooling on a wire rack\", \"decorative\": false}, \"id\": \"556e76b0-0f5a-42bb-b039-653f3d6b1f0b\"}, {\"type\": \"paragraph_block\", \"value\": \"

The cake is likely derived from the Washington pie, a two-layer yellow cake filled with jam and topped with confectioner's sugar, for which pastry cream of custard eventually replaced the jam, and a chocolate glaze replaced the confectioner's sugar.[2] Today, the cake is topped with a chocolate glaze (such as ganache) and sometimes powdered sugar or a cherry.

The name first appeared in the 1872 Methodist Almanac.[3] Another early printed use of the term \\\"Boston cream pie\\\" occurred in the Granite Iron Ware Cook Book, printed in 1878.[2] The earliest known recipe of the modern variant was printed in Miss Parloa's Kitchen Companion in 1887 as \\\"Chocolate Cream Pie\\\".[2]

And on another note, here are cookies baking in the oven:

\", \"id\": \"ac48af95-b3be-4602-8c2f-5c43fc080f17\"}]", + "subtitle": "Banana toffee chocolate pie?", + "date_published": "2019-02-24", + "wagtail_admin_comments": [], + "blog_person_relationship": [ + { + "pk": 9, + "sort_order": 0, + "page": 77, + "person": 2 + } + ], + "tagged_items": [ + { + "pk": null, + "tag": 11, + "content_object": 77 + } + ] + }, + "approved_go_live_at": null + } + }, { "model": "wagtailcore.page", "pk": 1, @@ -10849,12 +10995,12 @@ "numchild": 0, "translation_key": "bef97199-e97c-425b-90b3-f4d606db810c", "locale": 1, - "latest_revision": 54, + "latest_revision": 113, "live": true, "has_unpublished_changes": false, "first_published_at": "2019-03-22T06:31:05.324Z", - "last_published_at": "2023-09-01T16:55:14.519Z", - "live_revision": 54, + "last_published_at": "2024-08-06T07:43:40.329Z", + "live_revision": 113, "go_live_at": null, "expire_at": null, "expired": false, @@ -10870,7 +11016,7 @@ "seo_title": "", "show_in_menus": false, "search_description": "", - "latest_revision_created_at": "2023-09-01T16:55:14.481Z", + "latest_revision_created_at": "2024-08-06T07:43:40.293Z", "alias_of": null } }, @@ -12827,7 +12973,8 @@ "current_time_zone": "", "avatar": "", "dismissibles": {}, - "theme": "system" + "theme": "system", + "density": "default" } }, { @@ -12843,7 +12990,8 @@ "current_time_zone": "", "avatar": "", "dismissibles": {}, - "theme": "system" + "theme": "system", + "density": "default" } }, { @@ -12859,7 +13007,8 @@ "current_time_zone": "Europe/Berlin", "avatar": "", "dismissibles": {}, - "theme": "system" + "theme": "system", + "density": "default" } }, { @@ -12875,7 +13024,8 @@ "current_time_zone": "Asia/Beirut", "avatar": "", "dismissibles": {}, - "theme": "system" + "theme": "system", + "density": "default" } }, { @@ -12891,7 +13041,8 @@ "current_time_zone": "", "avatar": "", "dismissibles": {}, - "theme": "system" + "theme": "system", + "density": "default" } }, { @@ -13220,7 +13371,7 @@ "fields": { "introduction": "A Boston cream pie is a yellow butter cake that is filled with custard or cream and topped with chocolate glaze.", "image": 43, - "body": "[{\"type\": \"paragraph_block\", \"value\": \"

Despite its name, it is in fact a cake, and not a pie.[2] The dessert acquired its name when cakes and pies were cooked in the same pans, and the words were used interchangeably.[3] In the latter part of the 19th century, this type of cake was variously called a "cream pie", a "chocolate cream pie", or a "custard cake".[3]

Owners of the Parker House Hotel in Boston claim that the Boston cream pie was first created at the hotel by Armenian-French chef M. Sanzian in 1856.[4] Called a "Chocolate Cream Pie", this cake consisted of two layers of French butter sponge cake filled with cr\\u00e8me p\\u00e2tissi\\u00e8re and brushed with a rum syrup, its side coated with cr\\u00e8me p\\u00e2tissi\\u00e8re overlain with toasted sliced almonds, and the top coated with chocolate fondant.[5] However, historians dispute this claim to primacy; while this cake may have been served then, there is no specific contemporaneous evidence of it, and custard-filled cake was already popular at that time.[3]

\", \"id\": \"b793eb57-cf99-4c2e-abc5-e3d5a8ea486b\"}, {\"type\": \"image_block\", \"value\": {\"image\": 15, \"caption\": \"Central Bakery\", \"attribution\": \"Creative Commons\"}, \"id\": \"556e76b0-0f5a-42bb-b039-653f3d6b1f0b\"}, {\"type\": \"paragraph_block\", \"value\": \"

The cake is likely derived from the Washington pie, a two-layer yellow cake filled with jam and topped with confectioner's sugar, for which pastry cream of custard eventually replaced the jam, and a chocolate glaze replaced the confectioner's sugar.[2] Today, the cake is topped with a chocolate glaze (such as ganache) and sometimes powdered sugar or a cherry.

The name first appeared in the 1872 Methodist Almanac.[3] Another early printed use of the term "Boston cream pie" occurred in the Granite Iron Ware Cook Book, printed in 1878.[2] The earliest known recipe of the modern variant was printed in Miss Parloa's Kitchen Companion in 1887 as "Chocolate Cream Pie".[2]

And on another note, here are cookies baking in the oven:

\", \"id\": \"ac48af95-b3be-4602-8c2f-5c43fc080f17\"}]", + "body": "[{\"type\": \"paragraph_block\", \"value\": \"

Despite its name, it is in fact a cake, and not a pie.[2] The dessert acquired its name when cakes and pies were cooked in the same pans, and the words were used interchangeably.[3] In the latter part of the 19th century, this type of cake was variously called a \\\"cream pie\\\", a \\\"chocolate cream pie\\\", or a \\\"custard cake\\\".[3]

Owners of the Parker House Hotel in Boston claim that the Boston cream pie was first created at the hotel by Armenian-French chef M. Sanzian in 1856.[4] Called a \\\"Chocolate Cream Pie\\\", this cake consisted of two layers of French butter sponge cake filled with cr\\u00e8me p\\u00e2tissi\\u00e8re and brushed with a rum syrup, its side coated with cr\\u00e8me p\\u00e2tissi\\u00e8re overlain with toasted sliced almonds, and the top coated with chocolate fondant.[5] However, historians dispute this claim to primacy; while this cake may have been served then, there is no specific contemporaneous evidence of it, and custard-filled cake was already popular at that time.[3]

\", \"id\": \"b793eb57-cf99-4c2e-abc5-e3d5a8ea486b\"}, {\"type\": \"image_block\", \"value\": {\"image\": 15, \"alt_text\": \"A freshly baked artisan bread with a golden-brown crust and a rounded shape, cooling on a wire rack\", \"decorative\": false}, \"id\": \"556e76b0-0f5a-42bb-b039-653f3d6b1f0b\"}, {\"type\": \"paragraph_block\", \"value\": \"

The cake is likely derived from the Washington pie, a two-layer yellow cake filled with jam and topped with confectioner's sugar, for which pastry cream of custard eventually replaced the jam, and a chocolate glaze replaced the confectioner's sugar.[2] Today, the cake is topped with a chocolate glaze (such as ganache) and sometimes powdered sugar or a cherry.

The name first appeared in the 1872 Methodist Almanac.[3] Another early printed use of the term \\\"Boston cream pie\\\" occurred in the Granite Iron Ware Cook Book, printed in 1878.[2] The earliest known recipe of the modern variant was printed in Miss Parloa's Kitchen Companion in 1887 as \\\"Chocolate Cream Pie\\\".[2]

And on another note, here are cookies baking in the oven:

\", \"id\": \"ac48af95-b3be-4602-8c2f-5c43fc080f17\"}]", "subtitle": "Banana toffee chocolate pie?", "date_published": "2019-02-24" } diff --git a/bakerydemo/base/migrations/0021_alter_footertext_locale_alter_formpage_body_and_more.py b/bakerydemo/base/migrations/0021_alter_footertext_locale_alter_formpage_body_and_more.py new file mode 100644 index 000000000..1c7c601a9 --- /dev/null +++ b/bakerydemo/base/migrations/0021_alter_footertext_locale_alter_formpage_body_and_more.py @@ -0,0 +1,369 @@ +# Generated by Django 4.2.13 on 2024-07-26 09:59 + +from django.db import migrations, models +import django.db.models.deletion +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailcore", "0094_alter_page_locale"), + ("base", "0020_alter_footertext_options"), + ] + + operations = [ + migrations.AlterField( + model_name="footertext", + name="locale", + field=models.ForeignKey( + editable=False, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="wagtailcore.locale", + verbose_name="locale", + ), + ), + migrations.AlterField( + model_name="formpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + ), + ), + migrations.AlterField( + model_name="gallerypage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + verbose_name="Page body", + ), + ), + migrations.AlterField( + model_name="homepage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + verbose_name="Home content block", + ), + ), + migrations.AlterField( + model_name="standardpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + verbose_name="Page body", + ), + ), + ] diff --git a/bakerydemo/blog/migrations/0007_alter_blogpage_body.py b/bakerydemo/blog/migrations/0007_alter_blogpage_body.py new file mode 100644 index 000000000..a833a039e --- /dev/null +++ b/bakerydemo/blog/migrations/0007_alter_blogpage_body.py @@ -0,0 +1,100 @@ +# Generated by Django 4.2.13 on 2024-07-26 09:59 + +from django.db import migrations +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("blog", "0006_rename_blogpeoplerelationship_person"), + ] + + operations = [ + migrations.AlterField( + model_name="blogpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + verbose_name="Page body", + ), + ), + ] diff --git a/bakerydemo/breads/migrations/0008_alter_breadpage_body.py b/bakerydemo/breads/migrations/0008_alter_breadpage_body.py new file mode 100644 index 000000000..4ec07c755 --- /dev/null +++ b/bakerydemo/breads/migrations/0008_alter_breadpage_body.py @@ -0,0 +1,100 @@ +# Generated by Django 4.2.13 on 2024-07-26 09:59 + +from django.db import migrations +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("breads", "0007_alter_breadingredient_options_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="breadpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + verbose_name="Page body", + ), + ), + ] diff --git a/bakerydemo/locations/migrations/0007_alter_locationpage_body.py b/bakerydemo/locations/migrations/0007_alter_locationpage_body.py new file mode 100644 index 000000000..6aaa5df1c --- /dev/null +++ b/bakerydemo/locations/migrations/0007_alter_locationpage_body.py @@ -0,0 +1,100 @@ +# Generated by Django 4.2.13 on 2024-07-26 09:59 + +from django.db import migrations +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("locations", "0006_alter_locationoperatinghours_day"), + ] + + operations = [ + migrations.AlterField( + model_name="locationpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + verbose_name="Page body", + ), + ), + ] diff --git a/bakerydemo/recipes/blocks.py b/bakerydemo/recipes/blocks.py index 4ec0e77e8..22145fc75 100644 --- a/bakerydemo/recipes/blocks.py +++ b/bakerydemo/recipes/blocks.py @@ -11,9 +11,8 @@ from wagtail.contrib.table_block.blocks import TableBlock from wagtail.contrib.typed_table_block.blocks import TypedTableBlock from wagtail.embeds.blocks import EmbedBlock -from wagtail.images.blocks import ImageChooserBlock -from bakerydemo.base.blocks import BlockQuote, HeadingBlock, ImageBlock +from bakerydemo.base.blocks import BlockQuote, CaptionedImageBlock, HeadingBlock class RecipeStepBlock(StructBlock): @@ -45,12 +44,12 @@ class RecipeStreamBlock(StreamBlock): ("text", CharBlock()), ("numeric", FloatBlock()), ("rich_text", RichTextBlock()), - ("image", ImageChooserBlock()), + ("image", CaptionedImageBlock()), ], group="Content", ) - image_block = ImageBlock(group="Media") + image_block = CaptionedImageBlock(group="Media") embed_block = EmbedBlock( help_text="Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", icon="media", diff --git a/bakerydemo/recipes/migrations/0002_alter_recipepage_backstory_alter_recipepage_body.py b/bakerydemo/recipes/migrations/0002_alter_recipepage_backstory_alter_recipepage_body.py new file mode 100644 index 000000000..3eaeaea99 --- /dev/null +++ b/bakerydemo/recipes/migrations/0002_alter_recipepage_backstory_alter_recipepage_body.py @@ -0,0 +1,260 @@ +# Generated by Django 4.2.13 on 2024-07-26 09:59 + +from django.db import migrations +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("recipes", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="recipepage", + name="backstory", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("image_block", 7), + ("block_quote", 10), + ("embed_block", 11), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + {"icon": "pilcrow", "template": "blocks/paragraph_block.html"}, + ), + 4: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 5: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 6: ("wagtail.blocks.CharBlock", (), {"required": False}), + 7: ( + "wagtail.blocks.StructBlock", + [[("image", 4), ("decorative", 5), ("alt_text", 6)]], + {}, + ), + 8: ("wagtail.blocks.TextBlock", (), {}), + 9: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [[("text", 8), ("attribute_name", 9)]], + {}, + ), + 11: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + }, + help_text="Use only a minimum number of headings and large blocks.", + ), + ), + migrations.AlterField( + model_name="recipepage", + name="body", + field=wagtail.fields.StreamField( + [ + ("heading_block", 2), + ("paragraph_block", 3), + ("block_quote", 6), + ("table_block", 7), + ("typed_table_block", 16), + ("image_block", 17), + ("embed_block", 18), + ("ingredients_list", 20), + ("steps_list", 23), + ], + blank=True, + block_lookup={ + 0: ( + "wagtail.blocks.CharBlock", + (), + {"form_classname": "title", "required": True}, + ), + 1: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "blank": True, + "choices": [ + ("", "Select a header size"), + ("h2", "H2"), + ("h3", "H3"), + ("h4", "H4"), + ], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.StructBlock", + [[("heading_text", 0), ("size", 1)]], + {"group": "Content"}, + ), + 3: ( + "wagtail.blocks.RichTextBlock", + (), + { + "group": "Content", + "icon": "pilcrow", + "template": "blocks/paragraph_block.html", + }, + ), + 4: ("wagtail.blocks.TextBlock", (), {}), + 5: ( + "wagtail.blocks.CharBlock", + (), + {"blank": True, "label": "e.g. Mary Berry", "required": False}, + ), + 6: ( + "wagtail.blocks.StructBlock", + [[("text", 4), ("attribute_name", 5)]], + {"group": "Content"}, + ), + 7: ( + "wagtail.contrib.table_block.blocks.TableBlock", + (), + {"group": "Content"}, + ), + 8: ("wagtail.blocks.CharBlock", (), {}), + 9: ("wagtail.blocks.FloatBlock", (), {}), + 10: ("wagtail.blocks.RichTextBlock", (), {}), + 11: ( + "wagtail.images.blocks.ImageChooserBlock", + (), + {"required": True}, + ), + 12: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "label": "Image is decorative", + "required": False, + }, + ), + 13: ("wagtail.blocks.CharBlock", (), {"required": False}), + 14: ( + "wagtail.blocks.StructBlock", + [[("image", 11), ("decorative", 12), ("alt_text", 13)]], + {"required": True}, + ), + 15: ( + "wagtail.blocks.StructBlock", + [[("image", 14), ("caption", 13), ("attribution", 13)]], + {}, + ), + 16: ( + "wagtail.contrib.typed_table_block.blocks.TypedTableBlock", + [ + [ + ("text", 8), + ("numeric", 9), + ("rich_text", 10), + ("image", 15), + ] + ], + {"group": "Content"}, + ), + 17: ( + "wagtail.blocks.StructBlock", + [[("image", 14), ("caption", 13), ("attribution", 13)]], + {"group": "Media"}, + ), + 18: ( + "wagtail.embeds.blocks.EmbedBlock", + (), + { + "group": "Media", + "help_text": "Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks", + "icon": "media", + "template": "blocks/embed_block.html", + }, + ), + 19: ( + "wagtail.blocks.RichTextBlock", + (), + {"features": ["bold", "italic", "link"]}, + ), + 20: ( + "wagtail.blocks.ListBlock", + (19,), + { + "group": "Cooking", + "icon": "list-ol", + "max_num": 10, + "min_num": 2, + }, + ), + 21: ( + "wagtail.blocks.ChoiceBlock", + [], + {"choices": [("S", "Small"), ("M", "Medium"), ("L", "Large")]}, + ), + 22: ( + "wagtail.blocks.StructBlock", + [[("text", 19), ("difficulty", 21)]], + {}, + ), + 23: ( + "wagtail.blocks.ListBlock", + (22,), + { + "group": "Cooking", + "icon": "tasks", + "max_num": 10, + "min_num": 2, + }, + ), + }, + help_text="The recipe’s step-by-step instructions and any other relevant information.", + ), + ), + ] diff --git a/bakerydemo/templates/blocks/image_block.html b/bakerydemo/templates/blocks/captioned_image_block.html similarity index 97% rename from bakerydemo/templates/blocks/image_block.html rename to bakerydemo/templates/blocks/captioned_image_block.html index 092ddb662..9a93f81d5 100644 --- a/bakerydemo/templates/blocks/image_block.html +++ b/bakerydemo/templates/blocks/captioned_image_block.html @@ -1,6 +1,6 @@ -{% load wagtailimages_tags %} - -
- {% picture self.image format-{avif,webp,jpeg} fill-{400x220,600x338} sizes="(max-width: 768px) 200px, 900px" loading="lazy" %} -
{{ self.caption }} - {{ self.attribution }}
-
+{% load wagtailimages_tags %} + +
+ {% picture self.image format-{avif,webp,jpeg} fill-{400x220,600x338} sizes="(max-width: 768px) 200px, 900px" loading="lazy" %} +
{{ self.caption }} - {{ self.attribution }}
+