wagtail-birdsong/birdsong/blocks.py

16 lines
554 B
Python
Raw Normal View History

2020-03-04 23:11:39 +00:00
from django.utils.html import mark_safe
from wagtail.core import blocks
class UnwrappedStreamBlock(blocks.StreamBlock):
"""Removes the surrounding divs around streamblocks."""
def render_basic(self, value, context=None):
return mark_safe('\n'.join(
child.render(context=context) for child in value))
class DefaultBlocks(UnwrappedStreamBlock):
2020-06-15 05:47:52 +00:00
rich_text = blocks.RichTextBlock(
template='birdsong/mail/blocks/richtext.html',
2020-03-04 23:11:39 +00:00
features=['h3', 'h4', 'bold', 'italic', 'link', 'ul', 'ol', 'document-link'])