-
Notifications
You must be signed in to change notification settings - Fork 770
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
Feature request: automatic filter negation/exclusion #978
Comments
This feature is much needed! |
I have no real desire to expand the API of django-filter. (I'm not in favour of automatically extending the filters available: these drive your database, you want to control them.) However, as I understand it, django-rest-framework-filters just builds on django-filter, so if you like its features, why not just use it? @rpkilby What is the state of play here? (Thanks!) |
Also, looking at the diff from the linked PR there, isn't a |
It's a little complicated. Automatic negation works for most cases, however it runs into issues with multi-valued relationships (see: philipn/django-rest-framework-filters#217). But in general, django-filter doesn't really handling to-many relationships well (#745, #1077), so maybe it should be considered out-of-scope, punting to drf-filters?
I would agree against expanding the API of the base |
Okay, thanks @rpkilby. I’m going to close. Don’t mind seeing examples from users but not ready to include, even as a mixin, at this point. |
This package supersedes django-rest-framework-filters, but django-rest-framework-filters had a great feature that allows you to do foo!=bar automatically (changes from a filter to an exclude).
https://github.com/philipn/django-rest-framework-filters#automatic-filter-negationexclusion
https://github.com/philipn/django-rest-framework-filters/pull/43/files
This is a nice saving, all of our filtersets look like this:
Would you accept a PR that included this functionality?
The text was updated successfully, but these errors were encountered: