Comments (8)
http://127.0.0.1:8000/api/customers/?in_use__iexact=no will work
from django-url-filter.
@miki725 Thank you I did see it works.
But is there a way to override in_use=no should be considered as iexact instead of exact.
I saw this method here for exact, I was thinking if I can override this on my side to iexact should work, but I was not successful here. :(
from django-url-filter.
you can do:
class CustomerFilterSet(FilterSet):
in_use = Filter(form_field=forms.CharField(), default_lookup='iexact')
from django-url-filter.
relevant docs https://django-url-filter.readthedocs.io/en/latest/api/url_filter.filters.html#url_filter.filters.Filter
from django-url-filter.
@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.
from django-url-filter.
what do you mean api level?
from django-url-filter.
@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.
the example provided deals with fields level not on entire model level, so I was thinking an option to set on entire api level what should be the default filter exact or iexact or contains or icontains
eg: default_filter = 'iexact' #this will be global setting
Thanks
from django-url-filter.
that could be possible although its not that simple. iexact
only makes sense for string fields. so the default will only have to apply where iexact
is possible. but yes that could definitely be added as an improvement
from django-url-filter.
Related Issues (20)
- lookups not limited according to field type
- __icontains is not working on list // arrayfields HOT 1
- Deprecated method ungettet_lazy HOT 9
- Filtering from custom DRF actions HOT 1
- Enabling all fields filtering by default
- Ignore empty fields HOT 1
- How can I filter with OR condition?
- UUID filter with lookup startswith HOT 4
- Package maintenance HOT 4
- Not compatible with Django 4.2.1 HOT 3
- ArrayField Support of Postgresql
- Fix the docs in url_filter/integrations/drf_coreapi.py HOT 2
- UTC datetimes in the database queried against the
- Support for []-style array arguments
- ISO datatime format HOT 2
- DateTime __date filter not working HOT 6
- CoreAPIURLFilterBackend causing recursion depth exceeded HOT 5
- Filtering on email field throws ValidationError HOT 1
- Error when trying to filter by a date range of a datetime field HOT 1
- How can I shorten the request
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-url-filter.