implement RawHTMLBlock

This commit is contained in:
Matt Westcott 2015-02-13 17:17:05 +00:00
parent 047ff734ca
commit 42940e6e4b

View file

@ -361,6 +361,19 @@ class RichTextBlock(FieldBlock):
def render_basic(self, value):
return mark_safe('<div class="rich-text">' + expand_db_html(value) + '</div>')
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):