diff --git a/website/blog/migrations/0020_alter_blogpostcollectionlistpage_body_and_more.py b/website/blog/migrations/0020_alter_blogpostcollectionlistpage_body_and_more.py new file mode 100644 index 0000000..2e311e8 --- /dev/null +++ b/website/blog/migrations/0020_alter_blogpostcollectionlistpage_body_and_more.py @@ -0,0 +1,905 @@ +# Generated by Django 4.0.6 on 2022-08-20 17:38 + +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", + "0019_rename_blogcollectionlistpage_blogpostcollectionlistpage_and_more", + ), + ] + + operations = [ + migrations.AlterField( + model_name="blogpostcollectionlistpage", + 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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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="blogpostcollectionpage", + 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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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="blogpostlistpage", + 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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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/0019_alter_contentpage_body_alter_listingpage_body.py b/website/common/migrations/0019_alter_contentpage_body_alter_listingpage_body.py new file mode 100644 index 0000000..e3ee1b3 --- /dev/null +++ b/website/common/migrations/0019_alter_contentpage_body_alter_listingpage_body.py @@ -0,0 +1,314 @@ +# Generated by Django 4.0.6 on 2022-08-20 17:38 + +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", "0018_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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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 ee73a05..2ac358a 100644 --- a/website/common/streamfield.py +++ b/website/common/streamfield.py @@ -37,7 +37,7 @@ class LoremBlock(blocks.StructBlock): class ImageCaptionBlock(blocks.StructBlock): image = ImageChooserBlock() - caption = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN) + caption = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN, required=False) class Meta: icon = "image" diff --git a/website/contact/migrations/0005_alter_contactpage_body.py b/website/contact/migrations/0005_alter_contactpage_body.py new file mode 100644 index 0000000..d20855b --- /dev/null +++ b/website/contact/migrations/0005_alter_contactpage_body.py @@ -0,0 +1,167 @@ +# Generated by Django 4.0.6 on 2022-08-20 17:38 + +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", "0004_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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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/contrib/mermaid_block/blocks.py b/website/contrib/mermaid_block/blocks.py index c8debc9..981423a 100644 --- a/website/contrib/mermaid_block/blocks.py +++ b/website/contrib/mermaid_block/blocks.py @@ -25,7 +25,7 @@ class MermaidStructValue(StructValue): class MermaidBlock(StructBlock): source = TextBlock() - caption = RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN) + caption = RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN, required=False) class Meta: icon = "edit" diff --git a/website/search/migrations/0004_alter_searchpage_body.py b/website/search/migrations/0004_alter_searchpage_body.py new file mode 100644 index 0000000..9d8f047 --- /dev/null +++ b/website/search/migrations/0004_alter_searchpage_body.py @@ -0,0 +1,167 @@ +# Generated by Django 4.0.6 on 2022-08-20 17:38 + +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", "0003_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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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/spotify/migrations/0005_alter_spotifyplaylistpage_body.py b/website/spotify/migrations/0005_alter_spotifyplaylistpage_body.py new file mode 100644 index 0000000..947edf0 --- /dev/null +++ b/website/spotify/migrations/0005_alter_spotifyplaylistpage_body.py @@ -0,0 +1,167 @@ +# Generated by Django 4.0.6 on 2022-08-20 17:38 + +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", "0004_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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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", + ], + required=False, + ), + ), + ] + ), + ), + ( + "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, + ), + ), + ]