0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 11:10:43 +01:00

Allow indexing arrays of model instances in FilterField

This commit is contained in:
Karl Hobley 2018-07-20 14:35:59 +01:00
parent a68597dadf
commit f67f0e39c3

View File

@ -263,6 +263,8 @@ class Elasticsearch2Mapping:
value = list(value.values_list('pk', flat=True))
elif isinstance(value, models.Model):
value = value.pk
elif isinstance(value, (list, tuple)):
value = [item.pk if isinstance(item, models.Model) else item for item in value]
doc[self.get_field_column_name(field)] = value