mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-12 17:23:15 +00:00
implement RawHTMLBlock
This commit is contained in:
parent
047ff734ca
commit
42940e6e4b
1 changed files with 13 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue