Add more content for the body of a blogpost

This commit is contained in:
Konstantin 2024-03-14 04:31:11 +01:00
parent 5c80ebe18d
commit 24123c99cf
4 changed files with 33 additions and 3 deletions

View file

@ -4,7 +4,7 @@ help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build: build:
@docker build -t code.headbright.be/konstantin/iamkonstantin:1.0.8 . @docker build -t code.headbright.be/konstantin/iamkonstantin:1.0.9 .
publish: publish:
@docker push code.headbright.be/konstantin/iamkonstantin:1.0.8 @docker push code.headbright.be/konstantin/iamkonstantin:1.0.9

View file

@ -1,8 +1,15 @@
from wagtail.blocks import RichTextBlock from wagtail.blocks import RichTextBlock
from wagtail.embeds.blocks import EmbedBlock
from base.blocks import StreamBlock from base.blocks import StreamBlock, HeadingBlock, ImageBlock
from wagtailcodeblock.blocks import CodeBlock from wagtailcodeblock.blocks import CodeBlock
class BlogPostBlock(StreamBlock): class BlogPostBlock(StreamBlock):
heading_block = HeadingBlock()
paragraph = RichTextBlock(blank=True) paragraph = RichTextBlock(blank=True)
code = CodeBlock(label='Code snippet') code = CodeBlock(label='Code snippet')
image_block = ImageBlock()
embed_block = EmbedBlock(
help_text="Insert a URL to embed. For example, https://www.youtube.com/watch?v=SGJFWirQ3ks",
icon="media",
)

View file

@ -0,0 +1,22 @@
# Generated by Django 5.0.2 on 2024-03-14 03:30
import wagtail.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0009_alter_blogpage_body'),
]
operations = [
migrations.AlterField(
model_name='blogpage',
name='body',
field=wagtail.fields.StreamField([('heading_block', wagtail.blocks.StructBlock([('heading_text', wagtail.blocks.CharBlock(form_classname='title', required=True)), ('size', wagtail.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a heading size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))])), ('paragraph', wagtail.blocks.RichTextBlock(blank=True)), ('code', wagtail.blocks.StructBlock([('language', wagtail.blocks.ChoiceBlock(choices=[('bash', 'Bash/Shell'), ('css', 'CSS'), ('dart', 'Dart'), ('docker', 'Docker'), ('elixir', 'Elixir'), ('go', 'Go'), ('html', 'HTML'), ('javascript', 'Javascript'), ('json', 'JSON'), ('kotlin', 'Kotlin'), ('python', 'Python'), ('swift', 'Swift'), ('toml', 'TOML'), ('yaml', 'YAML')], help_text='Coding language', identifier='language', label='Language')), ('code', wagtail.blocks.TextBlock(identifier='code', label='Code'))], label='Code snippet')), ('image_block', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.blocks.CharBlock(required=False)), ('attribution', wagtail.blocks.CharBlock(required=False))])), ('embed_block', wagtail.embeds.blocks.EmbedBlock(help_text='Insert a URL to embed. For example, https://www.youtube.com/watch?v=SGJFWirQ3ks', icon='media'))], blank=True, help_text='Write anything'),
),
]

View file

@ -193,6 +193,7 @@ WAGTAIL_CODE_BLOCK_LANGUAGES = (
('kotlin', 'Kotlin'), ('kotlin', 'Kotlin'),
('python', 'Python'), ('python', 'Python'),
('swift', 'Swift'), ('swift', 'Swift'),
('toml', 'TOML'),
('yaml', 'YAML'), ('yaml', 'YAML'),
) )