Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
paragraph = RichTextBlock(
icon='pilcrow',
features=['bold', 'italic', 'link', 'ol', 'ul', 'monospace'],
)
image = CaptionedImageBlock()
document = DocumentChooserBlock()
embed = EmbedBlock(icon='media')
table = TableBlock(icon='table')
code = CodeBlock(icon='code')
class Meta:
help_text = 'The main page body.'
class ContentStreamBlockWithRawCode(ContentStreamBlock):
raw_code = CodeBlock(
icon='code',
language='html',
template='wagtailcodeblock/raw_code.html',
)
class SectionStructBlock(StructBlock):
"""
Contains the elements we'll want to have in a Sectioned Content Stream block.
"""
section_heading = TextBlock(
icon='title',
help_text='Heading for this section.',
)
body = ContentStreamBlock(
help_text='The body content goes here.',
"""
Contains the elements we'll want to have in a Content Stream.
"""
heading = TextBlock(
icon='title',
template='wagtailcontentstream/blocks/heading.html',
)
paragraph = RichTextBlock(
icon='pilcrow',
features=['bold', 'italic', 'link', 'ol', 'ul', 'monospace'],
)
image = CaptionedImageBlock()
document = DocumentChooserBlock()
embed = EmbedBlock(icon='media')
table = TableBlock(icon='table')
code = CodeBlock(icon='code')
class Meta:
help_text = 'The main page body.'
class ContentStreamBlockWithRawCode(ContentStreamBlock):
raw_code = CodeBlock(
icon='code',
language='html',
template='wagtailcodeblock/raw_code.html',
)
class SectionStructBlock(StructBlock):
"""
Contains the elements we'll want to have in a Sectioned Content Stream block.
)
from wagtail.wagtailcore.blocks import StreamBlock
from wagtail.wagtailembeds.blocks import EmbedBlock
from wagtail.contrib.table_block.blocks import TableBlock
from wagtailcodeblock.blocks import CodeBlock
from .blocks import CaptionedImageBlock
class ContentStream(StreamBlock):
paragraph = RichTextBlock(icon='fa-paragraph')
heading = TextBlock(icon='fa-header', template='wagtailcontentstream/blocks/heading.html')
image = CaptionedImageBlock()
table = TableBlock(icon='fa-table')
embed = EmbedBlock(icon='fa-youtube-play')
code = CodeBlock(label='Code snippet')
class Meta:
template = 'standard/blocks/streamfield.html'