Skip to content
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

New ImageBlock with contextual alt text #492

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bakerydemo/base/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
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):
Chiemezuo marked this conversation as resolved.
Show resolved Hide resolved
"""
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)

Expand Down
112 changes: 52 additions & 60 deletions bakerydemo/base/fixtures/bakerydemo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1403,8 +1355,10 @@
"fields": {
"query": 1,
"page": 63,
"sort_order": 0,
"description": ""
"external_link_url": "",
"external_link_text": null,
"description": "",
"sort_order": 0
}
},
{
Expand All @@ -1413,8 +1367,10 @@
"fields": {
"query": 4,
"page": 40,
"sort_order": 0,
"description": ""
"external_link_url": "",
"external_link_text": null,
"description": "",
"sort_order": 0
}
},
{
Expand All @@ -1423,8 +1379,10 @@
"fields": {
"query": 5,
"page": 36,
"sort_order": 0,
"description": ""
"external_link_url": "",
"external_link_text": null,
"description": "",
"sort_order": 0
}
},
{
Expand Down Expand Up @@ -1523,6 +1481,13 @@
"workflow": 1
}
},
{
"model": "wagtailcore.workflowcontenttype",
"pk": 26,
"fields": {
"workflow": 1
}
},
{
"model": "wagtailcore.workflowtask",
"pk": 1,
Expand Down Expand Up @@ -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-06T01:35:00.245Z",
"is_superuser": true,
"username": "admin",
"first_name": "Admin",
Expand Down Expand Up @@ -12085,6 +12050,28 @@
"created_at": "2019-06-23T09:08:36.064Z"
}
},
{
"model": "wagtailadmin.editingsession",
"pk": 1,
"fields": {
"user": ["admin"],
"content_type": ["wagtailcore", "page"],
"object_id": "82",
"last_seen_at": "2024-08-06T01:35:42.544Z",
"is_editing": false
}
},
{
"model": "wagtailadmin.editingsession",
"pk": 2,
"fields": {
"user": ["admin"],
"content_type": ["wagtailcore", "page"],
"object_id": "82",
"last_seen_at": "2024-08-06T01:38:47.215Z",
"is_editing": false
}
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These models are new, should these be part of the fixtures? Asking @laymonage or @gasman for input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to add new models, that should be done in a separate PR. For this PR, we should filter the fixture changes to only the ones relevant for the PR.

{
"model": "wagtailimages.image",
"pk": 8,
Expand Down Expand Up @@ -12827,7 +12814,8 @@
"current_time_zone": "",
"avatar": "",
"dismissibles": {},
"theme": "system"
"theme": "system",
"density": "default"
}
},
{
Expand All @@ -12843,7 +12831,8 @@
"current_time_zone": "",
"avatar": "",
"dismissibles": {},
"theme": "system"
"theme": "system",
"density": "default"
}
},
{
Expand All @@ -12859,7 +12848,8 @@
"current_time_zone": "Europe/Berlin",
"avatar": "",
"dismissibles": {},
"theme": "system"
"theme": "system",
"density": "default"
}
},
{
Expand All @@ -12875,7 +12865,8 @@
"current_time_zone": "Asia/Beirut",
"avatar": "",
"dismissibles": {},
"theme": "system"
"theme": "system",
"density": "default"
}
},
{
Expand All @@ -12891,7 +12882,8 @@
"current_time_zone": "",
"avatar": "",
"dismissibles": {},
"theme": "system"
"theme": "system",
"density": "default"
}
},
{
Expand Down
Loading
Loading