Skip to content

Commit 261adec

Browse files
committed
StreamField Deep Dive: CharBlock
1 parent 4efc063 commit 261adec

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

flex/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
55
from wagtail.core.fields import StreamField
66
from wagtail.core.models import Page
7+
from wagtail.core import blocks as streamfield_blocks
78

89
from streams import blocks
910

@@ -25,6 +26,13 @@ class FlexPage(Page):
2526
("cards", blocks.CardBlock()),
2627
("cta", blocks.CTABlock()),
2728
("button", blocks.ButtonBlock()),
29+
("char_block", streamfield_blocks.CharBlock(
30+
required=True,
31+
help_text='Oh wow this is help text!!',
32+
min_length=10,
33+
max_length=50,
34+
template="streams/char_block.html",
35+
))
2836
],
2937
null=True,
3038
blank=True,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div class="container">
2+
<div class="row">
3+
<div class="col-sm-10 offset-sm-1">
4+
{{ self }}
5+
</div>
6+
</div>
7+
</div>

0 commit comments

Comments
 (0)