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
Add a "not equal" lookup for filters #452
Conversation
fixes #5854 Required PR: pulp/pulpcore#452
| @Field.register_lookup | ||
| class NotEqualLookup(Lookup): | ||
| # this is copied from https://docs.djangoproject.com/en/3.0/howto/custom-lookups/ | ||
| lookup_name = 'ne' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback welcome here on what we want to name this. The django example used ne.
82831e1
to
c08e642
Compare
fixes #5854 Required PR: pulp/pulpcore#452
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ne seems like an acceptable name for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. I can't see a better way to do it in DRF or django-filter, so let's use this. 👍
|
I'm looking at a package called django-rest-framework-filters since it has support for negating filters: https://github.com/philipn/django-rest-framework-filters#automatic-filter-negationexclusion It basically adds some extra DRF functionality to django-filter. |
|
I had a chance to look into django-rest-framework-filters and it seems to work pretty well (at least for searching on NOT conditions). Moreover, you can combine it with other lookups (e.g. The only downside is we have to use a prerelease version from September 2018 (1.0.0.dev0) and it looks like there is no timeline for a 1.0.0 release. I'm torn and don't have a strong opinion on whether to just go with this PR or use drf-filters. |
|
I also don't have a strong opinion. If it's working and that project is already dedicated to that type of feature set I lean towards using |
I think we should go w/ the django-rest-framework-filters project.
|
I agree that we should use the 3rd party package with one caveat: We should make sure it's compatible with the range filters we currently support on some fields https://github.com/philipn/django-rest-framework-filters#multiwidget-is-incompatible (I think it is compatible, but the range bit stuck out as something to look into) |
|
I plan to merge this on Monday February 10th. django-rest-framework-filters uses |
fixes #5854 Required PR: pulp/pulpcore#452
fixes #5854 Required PR: pulp/pulpcore#452
fixes #5868
https://pulp.plan.io/issues/5868
Please be sure you have read our documentation on creating PRs:
https://docs.pulpproject.org/en/3.0/nightly/contributing/pull-request-walkthrough.html