fix error with multi-level lookup in wrapped ORM
@@ -508,7 +508,8 @@ class BaseQueryWrapper(BaseWrapper):
subkwargs = {'__'.join([filter_type] + segments): filter_value}
pk_values = self._changeset.wrap_model(rel_model).objects.filter(**subkwargs).values_list('pk', flat=True)
q = Q(**{field_name+'__pk__in': pk_values})
- return self._filter_values(q, field_name, lambda val: str(val) in filter_value)
+ pk_values = set(str(pk) for pk in pk_values)
+ return self._filter_values(q, field_name, lambda val: str(val) in pk_values)
# check if we are filtering by a many to many field
if field.many_to_many:
