mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Using https://docs.djangoproject.com/en/1.8/ref/models/querysets/#regex for search filter by starting field with '$'
This commit is contained in:
parent
f601c6c1c3
commit
314daaedfa
|
@ -94,6 +94,8 @@ class SearchFilter(BaseFilterBackend):
|
||||||
return "%s__iexact" % field_name[1:]
|
return "%s__iexact" % field_name[1:]
|
||||||
elif field_name.startswith('@'):
|
elif field_name.startswith('@'):
|
||||||
return "%s__search" % field_name[1:]
|
return "%s__search" % field_name[1:]
|
||||||
|
if field_name.startswith('$'):
|
||||||
|
return "%s__iregex" % field_name[1:]
|
||||||
else:
|
else:
|
||||||
return "%s__icontains" % field_name
|
return "%s__icontains" % field_name
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user