mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-12 09:13:14 +00:00
ditch HeadingBlock in favour of a CharBlock that doesn't know its own native rendering
This commit is contained in:
parent
0afb1a3b50
commit
53e1ee44e5
1 changed files with 5 additions and 7 deletions
|
|
@ -273,13 +273,11 @@ class FieldBlock(Block):
|
|||
def clean(self, value):
|
||||
return self.field.clean(value)
|
||||
|
||||
class HeadingBlock(FieldBlock):
|
||||
def __init__(self, tag_name='h1', **kwargs):
|
||||
self.tag_name = tag_name
|
||||
super(HeadingBlock, self).__init__(CharField(), **kwargs)
|
||||
|
||||
def render(self, value):
|
||||
return format_html("<{tag}>{value}</{tag}>", tag=self.tag_name, value=value)
|
||||
class CharBlock(FieldBlock):
|
||||
def __init__(self, **kwargs):
|
||||
super(CharBlock, self).__init__(CharField(), **kwargs)
|
||||
# TODO: some kwargs, such as max_length, and *possibly* things like help_text, should be passed to
|
||||
# the CharField constructor. Figure out a system for doing this
|
||||
|
||||
# =======
|
||||
# Chooser
|
||||
|
|
|
|||
Loading…
Reference in a new issue