-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question - How to make case insensitive filter? #59
Comments
you can do: class CustomerFilterSet(FilterSet):
in_use = Filter(form_field=forms.CharField(), default_lookup='iexact') |
@miki725 Thank you for the right direction. Is there a option to set default_lookup to iexact on api level or on model level? Setting this on a field level is not a ideal situation in my case. Once again thanks a lot for your help. |
what do you mean api level? |
@miki725 apologies i missed this comment. When i say api level, i mean option to set all fields to case insensitive rather than setting per field basis like the example which is provided. Thanks |
that could be possible although its not that simple. |
Hi,
How can I achieve case insensitive filter on my requests?
for eg:
http://127.0.0.1:8000/api/customers/?in_use=No -- This works
http://127.0.0.1:8000/api/customers/?in_use=no -- Does not work because database stored this value as No
I think we have to use iexact option instead of exact, but not getting where to over ride this without impacting the original library.
Your assistance is helpful here
Thanks
The text was updated successfully, but these errors were encountered: