From 42940e6e4beca4bbb803932d009a748da2581f39 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Fri, 13 Feb 2015 17:17:05 +0000 Subject: [PATCH] implement RawHTMLBlock --- wagtail/wagtailadmin/blocks.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wagtail/wagtailadmin/blocks.py b/wagtail/wagtailadmin/blocks.py index 53d04eac6..61d77a778 100644 --- a/wagtail/wagtailadmin/blocks.py +++ b/wagtail/wagtailadmin/blocks.py @@ -361,6 +361,19 @@ class RichTextBlock(FieldBlock): def render_basic(self, value): return mark_safe('
' + expand_db_html(value) + '
') +class RawHTMLBlock(FieldBlock): + def __init__(self, required=True, help_text=None, max_length=None, min_length=None, **kwargs): + self.field = forms.CharField( + required=required, help_text=help_text, max_length=max_length, min_length=min_length, + widget = forms.Textarea) + super(RawHTMLBlock, self).__init__(**kwargs) + + def render_basic(self, value): + return mark_safe(value) # if it isn't safe, that's the site admin's problem for allowing raw HTML blocks in the first place... + + class Meta: + icon = 'code' + class ChooserBlock(FieldBlock): def __init__(self, required=True, **kwargs):