mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-19 04:31:11 +00:00
Fix Wagtail search fails when indexing
This commit is contained in:
parent
4e7ccdcdc9
commit
35533ad90f
1 changed files with 3 additions and 1 deletions
|
|
@ -7,8 +7,10 @@ from django.db import models
|
|||
from django.db.models.fields import FieldDoesNotExist
|
||||
from django.db.models.fields.related import ForeignObjectRel, OneToOneRel, RelatedField
|
||||
|
||||
from modelcluster.fields import ParentalManyToManyField
|
||||
from wagtail.search.backends import get_search_backends_with_name
|
||||
|
||||
|
||||
logger = logging.getLogger('wagtail.search.index')
|
||||
|
||||
|
||||
|
|
@ -256,7 +258,7 @@ class RelatedFields:
|
|||
except FieldDoesNotExist:
|
||||
return queryset
|
||||
|
||||
if isinstance(field, RelatedField):
|
||||
if isinstance(field, RelatedField) and not isinstance(field, ParentalManyToManyField):
|
||||
if field.many_to_one or field.one_to_one:
|
||||
queryset = queryset.select_related(self.field_name)
|
||||
elif field.one_to_many or field.many_to_many:
|
||||
|
|
|
|||
Loading…
Reference in a new issue