diff --git a/wagtail/wagtailcore/blocks.py b/wagtail/wagtailcore/blocks.py index c08c424bb..b476e6eb3 100644 --- a/wagtail/wagtailcore/blocks.py +++ b/wagtail/wagtailcore/blocks.py @@ -353,9 +353,6 @@ class FieldBlock(Block): def clean(self, value): return self.field.clean(value) - def get_searchable_content(self, value): - return [value] - class CharBlock(FieldBlock): def __init__(self, required=True, help_text=None, max_length=None, min_length=None, **kwargs): @@ -363,11 +360,16 @@ class CharBlock(FieldBlock): self.field = forms.CharField(required=required, help_text=help_text, max_length=max_length, min_length=min_length) super(CharBlock, self).__init__(**kwargs) + def get_searchable_content(self, value): + return [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) super(URLBlock, self).__init__(**kwargs) + class RichTextBlock(FieldBlock): @cached_property def field(self): @@ -377,6 +379,10 @@ class RichTextBlock(FieldBlock): def render_basic(self, value): return mark_safe('
' + expand_db_html(value) + '
') + def get_searchable_content(self, value): + return [value] + + class RawHTMLBlock(FieldBlock): def __init__(self, required=True, help_text=None, max_length=None, min_length=None, **kwargs): self.field = forms.CharField( diff --git a/wagtail/wagtailcore/tests/test_blocks.py b/wagtail/wagtailcore/tests/test_blocks.py index 06186633d..17bf1b81e 100644 --- a/wagtail/wagtailcore/tests/test_blocks.py +++ b/wagtail/wagtailcore/tests/test_blocks.py @@ -292,7 +292,7 @@ class TestStructBlock(unittest.TestCase): 'link': 'http://www.wagtail.io', }) - self.assertEqual(content, ["Wagtail site", "http://www.wagtail.io"]) + self.assertEqual(content, ["Wagtail site"]) class TestListBlock(unittest.TestCase): @@ -447,7 +447,7 @@ class TestListBlock(unittest.TestCase): }, ]) - self.assertEqual(content, ["Wagtail", "http://www.wagtail.io", "Django", "http://www.djangoproject.com"]) + self.assertEqual(content, ["Wagtail", "Django"]) class TestStreamBlock(unittest.TestCase):