mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-24 14:53:45 +00:00
Hooked blocks get_searchable_content into wagtailsearch
This commit is contained in:
parent
acdf4bbefe
commit
3843123e41
2 changed files with 7 additions and 1 deletions
|
|
@ -82,3 +82,6 @@ class StreamField(with_metaclass(models.SubfieldBase, models.Field)):
|
|||
def value_to_string(self, obj):
|
||||
value = self._get_val_from_obj(obj)
|
||||
return self.get_prep_value(value)
|
||||
|
||||
def get_searchable_content(self, value):
|
||||
return self.stream_block.get_searchable_content(value)
|
||||
|
|
|
|||
|
|
@ -116,7 +116,10 @@ class BaseField(object):
|
|||
def get_value(self, obj):
|
||||
try:
|
||||
field = self.get_field(obj.__class__)
|
||||
return field._get_val_from_obj(obj)
|
||||
value = field._get_val_from_obj(obj)
|
||||
if hasattr(field, 'get_searchable_content'):
|
||||
value = field.get_searchable_content(value)
|
||||
return value
|
||||
except models.fields.FieldDoesNotExist:
|
||||
value = getattr(obj, self.field_name, None)
|
||||
if hasattr(value, '__call__'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue