-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update blocks in RecipeStreamBlock
to use ImageBlock
#526
Merged
thibaudcolas
merged 5 commits into
wagtail:main
from
laymonage:use-image-block-in-recipes
Feb 21, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
33f5a52
Update fixtures
Chiemezuo 3397b34
Backfill image description field
laymonage 2c29a34
Rename ImageBlock to CaptionedImageBlock
Chiemezuo 336e7af
Use Wagtail's ImageBlock in RecipeStreamBlock
laymonage e978840
Add image block to Hot Cross Buns page
laymonage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+66 KB
bakerydemo/base/fixtures/media/original_images/Hot_cross_buns_stacked.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
bakerydemo/recipes/migrations/0002_alter_recipepage_body.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# Generated by Django 6.0.dev20250116121251 on 2025-02-11 16:44 | ||
|
||
import wagtail.fields | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("recipes", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
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", 12), | ||
("image_block", 13), | ||
("embed_block", 14), | ||
("ingredients_list", 16), | ||
("steps_list", 19), | ||
], | ||
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.ImageBlock", [], {}), | ||
12: ( | ||
"wagtail.contrib.typed_table_block.blocks.TypedTableBlock", | ||
[ | ||
[ | ||
("text", 8), | ||
("numeric", 9), | ||
("rich_text", 10), | ||
("image", 11), | ||
] | ||
], | ||
{"group": "Content"}, | ||
), | ||
13: ("wagtail.images.blocks.ImageBlock", [], {"group": "Media"}), | ||
14: ( | ||
"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", | ||
}, | ||
), | ||
15: ( | ||
"wagtail.blocks.RichTextBlock", | ||
(), | ||
{"features": ["bold", "italic", "link"]}, | ||
), | ||
16: ( | ||
"wagtail.blocks.ListBlock", | ||
(15,), | ||
{ | ||
"group": "Cooking", | ||
"icon": "list-ol", | ||
"max_num": 10, | ||
"min_num": 2, | ||
}, | ||
), | ||
17: ( | ||
"wagtail.blocks.ChoiceBlock", | ||
[], | ||
{"choices": [("S", "Small"), ("M", "Medium"), ("L", "Large")]}, | ||
), | ||
18: ( | ||
"wagtail.blocks.StructBlock", | ||
[[("text", 15), ("difficulty", 17)]], | ||
{}, | ||
), | ||
19: ( | ||
"wagtail.blocks.ListBlock", | ||
(18,), | ||
{ | ||
"group": "Cooking", | ||
"icon": "tasks", | ||
"max_num": 10, | ||
"min_num": 2, | ||
}, | ||
), | ||
}, | ||
help_text="The recipe’s step-by-step instructions and any other relevant information.", | ||
), | ||
), | ||
] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,8 +183,8 @@ If you're a Python or Django developer, fork the repo and get stuck in! If you'd | |
If you change content or images in this repo and need to prepare a new fixture file for export, do the following on a branch: | ||
|
||
```bash | ||
./manage.py dumpdata --natural-foreign --indent 2 -e auth.permission -e contenttypes -e wagtailcore.GroupCollectionPermission -e wagtailimages.rendition -e sessions -e wagtailsearch.indexentry -e wagtailsearch.sqliteftsindexentry -e wagtailcore.referenceindex -e wagtailcore.pagesubscription > bakerydemo/base/fixtures/bakerydemo.json | ||
prettier --write bakerydemo/base/fixtures/bakerydemo.json | ||
./manage.py dumpdata --natural-foreign --indent 2 -e auth.permission -e contenttypes -e wagtailcore.GroupCollectionPermission -e wagtailimages.rendition -e sessions -e wagtailsearch.indexentry -e wagtailsearch.sqliteftsindexentry -e wagtailcore.referenceindex -e wagtailcore.pagesubscription -e wagtailcore.workflowcontenttype -e wagtailadmin.editingsession > bakerydemo/base/fixtures/bakerydemo.json | ||
npx prettier --write bakerydemo/base/fixtures/bakerydemo.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! |
||
``` | ||
|
||
Please optimize any included images to 1200px wide with JPEG compression at 60%. Note that `media/images` is ignored in the repo by `.gitignore` but `media/original_images` is not. Wagtail's local image "renditions" are excluded in the fixture recipe above. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎