mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-14 12:01:00 +00:00
add TextBlock
This commit is contained in:
parent
692901eaa1
commit
40ebd540f6
1 changed files with 13 additions and 1 deletions
|
|
@ -67,6 +67,18 @@ class CharBlock(FieldBlock):
|
|||
return [force_text(value)]
|
||||
|
||||
|
||||
class TextBlock(FieldBlock):
|
||||
def __init__(self, required=True, help_text=None, max_length=None, min_length=None, **kwargs):
|
||||
self.field = forms.CharField(
|
||||
widget=forms.Textarea(),
|
||||
required=required, help_text=help_text,
|
||||
max_length=max_length, min_length=min_length)
|
||||
super(TextBlock, self).__init__(**kwargs)
|
||||
|
||||
def get_searchable_content(self, value):
|
||||
return [force_text(value)]
|
||||
|
||||
|
||||
class URLBlock(FieldBlock):
|
||||
def __init__(self, required=True, help_text=None, max_length=None, min_length=None, **kwargs):
|
||||
self.field = forms.URLField(required=required, help_text=help_text, max_length=max_length, min_length=min_length)
|
||||
|
|
@ -279,7 +291,7 @@ class PageChooserBlock(ChooserBlock):
|
|||
# rather than wagtailcore.blocks.field.FooBlock
|
||||
block_classes = [
|
||||
FieldBlock, CharBlock, URLBlock, RichTextBlock, RawHTMLBlock, ChooserBlock, PageChooserBlock,
|
||||
BooleanBlock, DateBlock, TimeBlock, DateTimeBlock, ChoiceBlock,
|
||||
TextBlock, BooleanBlock, DateBlock, TimeBlock, DateTimeBlock, ChoiceBlock,
|
||||
]
|
||||
DECONSTRUCT_ALIASES = {
|
||||
cls: 'wagtail.wagtailcore.blocks.%s' % cls.__name__
|
||||
|
|
|
|||
Loading…
Reference in a new issue