Skip to content
Permalink
Browse files

StreamField Deep Dive: CharBlock

  • Loading branch information...
KalobTaulien committed Jun 5, 2019
1 parent 4efc063 commit 261adec1f07a4fe74f53610b69418b5f52484240
Showing with 15 additions and 0 deletions.
  1. +8 −0 flex/models.py
  2. +7 −0 mysite/templates/streams/char_block.html
@@ -4,6 +4,7 @@
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail.core import blocks as streamfield_blocks

from streams import blocks

@@ -25,6 +26,13 @@ class FlexPage(Page):
("cards", blocks.CardBlock()),
("cta", blocks.CTABlock()),
("button", blocks.ButtonBlock()),
("char_block", streamfield_blocks.CharBlock(
required=True,
help_text='Oh wow this is help text!!',
min_length=10,
max_length=50,
template="streams/char_block.html",
))
],
null=True,
blank=True,
@@ -0,0 +1,7 @@
<div class="container">
<div class="row">
<div class="col-sm-10 offset-sm-1">
{{ self }}
</div>
</div>
</div>

1 comment on commit 261adec

Please sign in to comment.
You can’t perform that action at this time.