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

Update the text-only blocks. #172

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
11 changes: 7 additions & 4 deletions home/blocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from wagtail.core import blocks
from __future__ import annotations

from wagtail.blocks import RichTextBlock
from wagtail.blocks import StreamBlock
from wagtail.contrib.table_block.blocks import TableBlock
from wagtail.blocks import StreamBlock, RichTextBlock
from wagtail.core import blocks
from wagtail.images.blocks import ImageChooserBlock


Expand Down Expand Up @@ -171,10 +174,10 @@ class Meta:

class BaseStreamBlock(StreamBlock):
heading = HeadingBlock()
paragraph = blocks.CharBlock(max_length=255)
paragraph = blocks.TextBlock()
html = blocks.RawHTMLBlock(icon="code", label="Raw HTML")
image = ImageChooserBlock()
text_with_heading = TextHeadingImageBlock()
text_with_heading = TextWithHeadingBlock()
text_with_heading_and_right_image = TextWithHeadingWithRightImageBlock()
text_with_heading_and_left_image = TextWithHeadingWithLeftImageBlock()
right_image_left_text = RightImageLeftTextBlock()
Expand Down
184 changes: 184 additions & 0 deletions home/puput_migrations/0004_alter_entrypage_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# Generated by Django 4.1.13 on 2023-12-29 01:59
from __future__ import annotations

import wagtail.blocks
import wagtail.contrib.table_block.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("puput", "0003_alter_entrypage_body"),
]

operations = [
migrations.AlterField(
model_name="entrypage",
name="body",
field=wagtail.fields.StreamField(
[
(
"heading",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog", max_length=255
),
)
]
),
),
("paragraph", wagtail.blocks.TextBlock()),
(
"html",
wagtail.blocks.RawHTMLBlock(icon="code", label="Raw HTML"),
),
("image", wagtail.images.blocks.ImageChooserBlock()),
(
"text_with_heading",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog", max_length=255
),
),
("text", wagtail.blocks.TextBlock()),
]
),
),
(
"text_with_heading_and_right_image",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog", max_length=255
),
),
("text", wagtail.blocks.TextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
]
),
),
(
"text_with_heading_and_left_image",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
class_name="blog", max_length=255
),
),
("text", wagtail.blocks.TextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
]
),
),
(
"right_image_left_text",
wagtail.blocks.StructBlock(
[
("image", wagtail.images.blocks.ImageChooserBlock()),
("text", wagtail.blocks.TextBlock()),
]
),
),
(
"left_image_right_text",
wagtail.blocks.StructBlock(
[
("image", wagtail.images.blocks.ImageChooserBlock()),
("text", wagtail.blocks.TextBlock()),
]
),
),
(
"left_quote_right_image",
wagtail.blocks.StructBlock(
[
("quote", wagtail.blocks.TextBlock()),
("byline", wagtail.blocks.CharBlock(max_length=255)),
("image", wagtail.images.blocks.ImageChooserBlock()),
]
),
),
(
"video_embed",
wagtail.blocks.StructBlock(
[
("heading", wagtail.blocks.CharBlock(max_length=255)),
("text", wagtail.blocks.TextBlock()),
]
),
),
("table", wagtail.contrib.table_block.blocks.TableBlock()),
(
"code_block",
wagtail.blocks.StructBlock(
[
(
"language",
wagtail.blocks.ChoiceBlock(
choices=[
("Python", "python"),
("Markup", "html"),
("CSS", "css"),
("Clojure", "clojure"),
("Bash", "shell"),
("Django", "django"),
("Jinja2", "jinja2"),
("Docker", "dockerfile"),
("Git", "git"),
("GraphQL", "graphql"),
("Handlebars", "handlebars"),
(".ignore", "gitignore"),
("JSON", "json"),
("JSON5", "json5"),
("Markdown", "md"),
("Markdown", "md"),
("React JSX", "jsx"),
("React TSX", "tsx"),
("SASS", "sass"),
("SCSS", "scss"),
("TypeScript", "ts"),
("vim", "vim"),
]
),
),
(
"caption",
wagtail.blocks.CharBlock(
blank=True, max_length=255
),
),
(
"page",
wagtail.blocks.CharBlock(
blank=True, max_length=255
),
),
(
"code",
wagtail.blocks.TextBlock(
blank=True, max_length=1000
),
),
]
),
),
("rich_text", wagtail.blocks.RichTextBlock()),
],
null=True,
use_json_field=True,
verbose_name="StreamField Body",
),
),
]
Loading