Learn Wagtail Course

StreamField Deep Dive: How to find undocumented options

Writing a StreamField without a custom class

For simple StreamFields you do not need to create custom classes. If you want to, that's 100% OK to do. Below you will see an example of a CharBlock that uses most of the available CharBlock kwargs.

from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail.core import blocks as streamfield_blocks

class FlexPage(Page):
    """Flexible page class."""

    content = StreamField(
            ("char_block", streamfield_blocks.CharBlock(
                help_text="Oh wow this is help text!!",

If you're wondering how I know we can use these fields:

  • required
  • help_text
  • min_length
  • max_length
  • template

Well the TL;DR version is: I went to the source code https://github.com/wagtail/wagtail/blob/master/wagtail/core/blocks/field_block.py#L97

If you want to know how I found this, you'll need to watch the video and about half way through I start talking about how to find the source code by working backwards from my current code.

The Git Commit

Was this helpful to you?

Sharing is caring. Help the community by sharing this article.