mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 08:59:54 +03:00
Allow to specify JSONField and HStoreField lookup paths in search_fields
This commit is contained in:
parent
de497a9bf1
commit
a716b28235
|
@ -90,6 +90,9 @@ class SearchFilter(BaseFilterBackend):
|
|||
parts = search_field.split(LOOKUP_SEP)
|
||||
for part in parts:
|
||||
field = opts.get_field(part)
|
||||
if field.get_internal_type() in ('JSONField', 'HStoreField'):
|
||||
# These fields support arbitrary key lookups
|
||||
break
|
||||
if hasattr(field, 'get_path_info'):
|
||||
# This field is a relation, update opts to follow the relation
|
||||
path_info = field.get_path_info()
|
||||
|
|
Loading…
Reference in New Issue
Block a user