From 3ff5f83d49e1da8a45d93e3ef639b712dc908385 Mon Sep 17 00:00:00 2001 From: "Ryan Harbert (Harpo)" Date: Fri, 15 Nov 2024 14:16:11 -0500 Subject: [PATCH] re-un-overwrites migration files --- .pre-commit-config.yaml | 2 +- .../migrations/0015_alter_exhibitpage_body.py | 205 ++++++++++++++++++ exhibits/models.py | 4 +- ov_collections/blocks.py | 8 +- .../0017_alter_collection_content.py | 204 +++++++++++++++++ ov_collections/models.py | 4 +- 6 files changed, 418 insertions(+), 9 deletions(-) create mode 100644 exhibits/migrations/0015_alter_exhibitpage_body.py create mode 100644 ov_collections/migrations/0017_alter_collection_content.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 10fd5ae..d5c5b91 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,4 +4,4 @@ repos: hooks: - id: ggshield language_version: python3 - stages: [commit] + stages: [pre-commit] diff --git a/exhibits/migrations/0015_alter_exhibitpage_body.py b/exhibits/migrations/0015_alter_exhibitpage_body.py new file mode 100644 index 0000000..b72329d --- /dev/null +++ b/exhibits/migrations/0015_alter_exhibitpage_body.py @@ -0,0 +1,205 @@ +# Generated by Django 5.1.3 on 2024-11-06 18:48 + +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("exhibits", "0014_alter_exhibitpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="exhibitpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("interviews", 8), + ("archival_footage", 9), + ("photographs", 10), + ("original_footage", 11), + ("programs", 12), + ("related_content", 13), + ("credits", 14), + ("heading", 15), + ("text", 16), + ("image", 17), + ("subheading", 15), + ("html", 18), + ], + block_lookup={ + 0: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "AAPB record IDs, separated by whitespace", + "required": True, + }, + ), + 1: ( + "wagtail.blocks.TextBlock", + (), + {"help_text": "Special collections IDs", "required": False}, + ), + 2: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "Show asset title(s) for this block", + "required": False, + }, + ), + 3: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "Show asset thumbnail(s) for this block", + "required": False, + }, + ), + 4: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "Include title in sidebar", + "required": False, + }, + ), + 5: ( + "wagtail.blocks.RichTextBlock", + (), + { + "features": ["italic"], + "help_text": "The title of this group", + "max_length": 1024, + "required": False, + }, + ), + 6: ( + "ov_collections.blocks.DurationBlock", + (), + {"help_text": "Start time for the group", "required": False}, + ), + 7: ( + "ov_collections.blocks.DurationBlock", + (), + {"help_text": "End time for the group", "required": False}, + ), + 8: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "openquote", "label": "Interviews"}, + ), + 9: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "clipboard-list", "label": "Archival Footage"}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "copy", "label": "Photographs"}, + ), + 11: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "doc-full-inverse", "label": "Original Footage"}, + ), + 12: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "desktop", "label": "Programs"}, + ), + 13: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "table", "label": "Related Content"}, + ), + 14: ("wagtail.blocks.RichTextBlock", (), {"icon": "form"}), + 15: ( + "wagtail.blocks.RichTextBlock", + (), + { + "features": ["italic"], + "form_classname": "title", + "icon": "title", + }, + ), + 16: ("exhibits.models.RichTextFootnotesBlock", (), {}), + 17: ("wagtail.images.blocks.ImageBlock", [], {}), + 18: ("wagtail.blocks.RawHTMLBlock", (), {"label": "HTML"}), + }, + ), + ), + ] diff --git a/exhibits/models.py b/exhibits/models.py index 8408c06..92b8358 100644 --- a/exhibits/models.py +++ b/exhibits/models.py @@ -9,7 +9,7 @@ from wagtail.blocks import RawHTMLBlock, RichTextBlock from wagtail.fields import StreamField from wagtail.images.api.fields import ImageRenditionField -from wagtail.images.blocks import ImageChooserBlock +from wagtail.images.blocks import ImageBlock from wagtail.models import Orderable, Page from wagtail.search import index from wagtail_footnotes.blocks import RichTextBlockWithFootnotes @@ -154,7 +154,7 @@ class ExhibitPage(HeadlessMixin, Page): ), ), ('text', RichTextFootnotesBlock()), - ('image', ImageChooserBlock()), + ('image', ImageBlock()), ( 'heading', RichTextBlock( diff --git a/ov_collections/blocks.py b/ov_collections/blocks.py index 87e39b6..92e3883 100644 --- a/ov_collections/blocks.py +++ b/ov_collections/blocks.py @@ -8,7 +8,7 @@ TextBlock, URLBlock, ) -from wagtail.images.blocks import ImageChooserBlock +from wagtail.images.blocks import ImageBlock class DurationBlock(FieldBlock): @@ -47,7 +47,7 @@ class Meta: class ContentBlock(StructBlock): """Generic External link block ) - from wagtail.images.blocks import ImageChooserBlock + from wagtail.images.blocks import ImageBlock title: RichTextBlock with italics only link: URLBlock @@ -66,10 +66,10 @@ class ContentImageBlock(ContentBlock): """Generic external link block with image Attributes: - image: ImageChooserBlock. Required. + image: ImageBlock. Required. """ - image = ImageChooserBlock(required=True) + image = ImageBlock(required=True) def get_api_representation(self, value, context=None): results = super().get_api_representation(value, context) diff --git a/ov_collections/migrations/0017_alter_collection_content.py b/ov_collections/migrations/0017_alter_collection_content.py new file mode 100644 index 0000000..131cfbf --- /dev/null +++ b/ov_collections/migrations/0017_alter_collection_content.py @@ -0,0 +1,204 @@ +# Generated by Django 5.1.2 on 2024-11-06 17:41 + +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("ov_collections", "0016_alter_collection_content"), + ] + + operations = [ + migrations.AlterField( + model_name="collection", + name="content", + field=wagtail.fields.StreamField( + [ + ("interviews", 8), + ("archival_footage", 9), + ("photographs", 10), + ("original_footage", 11), + ("programs", 12), + ("related_content", 13), + ("credits", 14), + ("heading", 15), + ("text", 16), + ("image", 17), + ("html", 18), + ], + block_lookup={ + 0: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "AAPB record IDs, separated by whitespace", + "required": True, + }, + ), + 1: ( + "wagtail.blocks.TextBlock", + (), + {"help_text": "Special collections IDs", "required": False}, + ), + 2: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "Show asset title(s) for this block", + "required": False, + }, + ), + 3: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "Show asset thumbnail(s) for this block", + "required": False, + }, + ), + 4: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "Include title in sidebar", + "required": False, + }, + ), + 5: ( + "wagtail.blocks.RichTextBlock", + (), + { + "features": ["italic"], + "help_text": "The title of this group", + "max_length": 1024, + "required": False, + }, + ), + 6: ( + "ov_collections.blocks.DurationBlock", + (), + {"help_text": "Start time for the group", "required": False}, + ), + 7: ( + "ov_collections.blocks.DurationBlock", + (), + {"help_text": "End time for the group", "required": False}, + ), + 8: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "openquote", "label": "Interviews"}, + ), + 9: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "clipboard-list", "label": "Archival Footage"}, + ), + 10: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "copy", "label": "Photographs"}, + ), + 11: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "doc-full-inverse", "label": "Original Footage"}, + ), + 12: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "desktop", "label": "Programs"}, + ), + 13: ( + "wagtail.blocks.StructBlock", + [ + [ + ("guids", 0), + ("special_collections", 1), + ("show_title", 2), + ("show_thumbnail", 3), + ("show_sidebar", 4), + ("title", 5), + ("start_time", 6), + ("end_time", 7), + ] + ], + {"icon": "table", "label": "Related Content"}, + ), + 14: ("wagtail.blocks.RichTextBlock", (), {"icon": "form"}), + 15: ( + "wagtail.blocks.RichTextBlock", + (), + { + "features": ["italic"], + "form_classname": "title", + "icon": "title", + }, + ), + 16: ("wagtail.blocks.RichTextBlock", (), {}), + 17: ("wagtail.images.blocks.ImageBlock", [], {}), + 18: ("wagtail.blocks.RawHTMLBlock", (), {"label": "HTML"}), + }, + ), + ), + ] diff --git a/ov_collections/models.py b/ov_collections/models.py index 9786276..6b38427 100644 --- a/ov_collections/models.py +++ b/ov_collections/models.py @@ -6,7 +6,7 @@ from wagtail.blocks import RawHTMLBlock, RichTextBlock from wagtail.fields import RichTextField, StreamField from wagtail.images.api.fields import ImageRenditionField -from wagtail.images.blocks import ImageChooserBlock +from wagtail.images.blocks import ImageBlock from wagtail.models import Page from wagtail.search import index from wagtail_headless_preview.models import HeadlessMixin @@ -42,7 +42,7 @@ class Collection(HeadlessMixin, Page): ), ), ('text', RichTextBlock()), - ('image', ImageChooserBlock()), + ('image', ImageBlock()), ('html', RawHTMLBlock(label='HTML')), ], )