From 09c4b93245bbb42c7fe86014ef080c8d26a2ab63 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 19 Aug 2022 13:48:45 +0100 Subject: [PATCH] Add typed table block --- ...er_blogcollectionlistpage_body_and_more.py | 890 ++++++++++++++++++ ...contentpage_body_alter_listingpage_body.py | 310 ++++++ website/common/streamfield.py | 14 + .../migrations/0004_alter_contactpage_body.py | 165 ++++ .../migrations/0003_alter_searchpage_body.py | 165 ++++ website/settings.py | 1 + .../0004_alter_spotifyplaylistpage_body.py | 165 ++++ 7 files changed, 1710 insertions(+) create mode 100644 website/blog/migrations/0018_alter_blogcollectionlistpage_body_and_more.py create mode 100644 website/common/migrations/0018_alter_contentpage_body_alter_listingpage_body.py create mode 100644 website/contact/migrations/0004_alter_contactpage_body.py create mode 100644 website/search/migrations/0003_alter_searchpage_body.py create mode 100644 website/spotify/migrations/0004_alter_spotifyplaylistpage_body.py diff --git a/website/blog/migrations/0018_alter_blogcollectionlistpage_body_and_more.py b/website/blog/migrations/0018_alter_blogcollectionlistpage_body_and_more.py new file mode 100644 index 0000000..6dc008a --- /dev/null +++ b/website/blog/migrations/0018_alter_blogcollectionlistpage_body_and_more.py @@ -0,0 +1,890 @@ +# Generated by Django 4.0.6 on 2022-08-19 12:45 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import website.contrib.code_block.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ("blog", "0017_alter_blogcollectionlistpage_body_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="blogcollectionlistpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="blogcollectionpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="bloglistpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="blogpostpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="blogposttaglistpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="blogposttagpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/website/common/migrations/0018_alter_contentpage_body_alter_listingpage_body.py b/website/common/migrations/0018_alter_contentpage_body_alter_listingpage_body.py new file mode 100644 index 0000000..1151e02 --- /dev/null +++ b/website/common/migrations/0018_alter_contentpage_body_alter_listingpage_body.py @@ -0,0 +1,310 @@ +# Generated by Django 4.0.6 on 2022-08-19 12:45 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import website.contrib.code_block.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ("common", "0017_alter_contentpage_body_alter_listingpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="contentpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="listingpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/website/common/streamfield.py b/website/common/streamfield.py index 8c48db7..ee73a05 100644 --- a/website/common/streamfield.py +++ b/website/common/streamfield.py @@ -5,6 +5,7 @@ from django.utils import lorem_ipsum from django.utils.html import format_html_join from django.utils.text import slugify from wagtail import blocks +from wagtail.contrib.typed_table_block.blocks import TypedTableBlock from wagtail.embeds.blocks import EmbedBlock from wagtail.images.blocks import ImageChooserBlock @@ -73,6 +74,19 @@ def get_blocks() -> list[tuple[str, blocks.BaseBlock]]: ("code", CodeBlock()), ("tangent", TangentBlock()), ("mermaid", MermaidBlock()), + ( + "table", + TypedTableBlock( + [ + ( + "rich_text", + blocks.RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN), + ), + ("numeric", blocks.FloatBlock()), + ("text", blocks.CharBlock()), + ] + ), + ), ] diff --git a/website/contact/migrations/0004_alter_contactpage_body.py b/website/contact/migrations/0004_alter_contactpage_body.py new file mode 100644 index 0000000..f9a664d --- /dev/null +++ b/website/contact/migrations/0004_alter_contactpage_body.py @@ -0,0 +1,165 @@ +# Generated by Django 4.0.6 on 2022-08-19 12:45 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import website.contrib.code_block.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ("contact", "0003_alter_contactpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="contactpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/website/search/migrations/0003_alter_searchpage_body.py b/website/search/migrations/0003_alter_searchpage_body.py new file mode 100644 index 0000000..c716143 --- /dev/null +++ b/website/search/migrations/0003_alter_searchpage_body.py @@ -0,0 +1,165 @@ +# Generated by Django 4.0.6 on 2022-08-19 12:45 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import website.contrib.code_block.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ("search", "0002_alter_searchpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="searchpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/website/settings.py b/website/settings.py index 0f1e515..d68301b 100644 --- a/website/settings.py +++ b/website/settings.py @@ -39,6 +39,7 @@ INSTALLED_APPS = [ "wagtail.contrib.redirects", "wagtail.contrib.modeladmin", "wagtail.contrib.routable_page", + "wagtail.contrib.typed_table_block", "wagtail.embeds", "wagtail.sites", "wagtail.users", diff --git a/website/spotify/migrations/0004_alter_spotifyplaylistpage_body.py b/website/spotify/migrations/0004_alter_spotifyplaylistpage_body.py new file mode 100644 index 0000000..bc0b458 --- /dev/null +++ b/website/spotify/migrations/0004_alter_spotifyplaylistpage_body.py @@ -0,0 +1,165 @@ +# Generated by Django 4.0.6 on 2022-08-19 12:45 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import website.contrib.code_block.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ("spotify", "0003_alter_spotifyplaylistpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="spotifyplaylistpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("embed", wagtail.embeds.blocks.EmbedBlock()), + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "h6", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + "snippet-embed", + ] + ), + ), + ( + "lorem", + wagtail.blocks.StructBlock( + [("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "code", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=website.contrib.code_block.blocks.get_language_choices + ), + ), + ("source", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "tangent", + wagtail.blocks.StructBlock( + [ + ("name", wagtail.blocks.CharBlock(max_length=64)), + ( + "content", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "mermaid", + wagtail.blocks.StructBlock( + [ + ("source", wagtail.blocks.TextBlock()), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + "code", + "strikethrough", + "snippet-link", + ] + ), + ), + ("numeric", wagtail.blocks.FloatBlock()), + ("text", wagtail.blocks.CharBlock()), + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ]