A few weeks ago, Katello opened an issue[0] requesting a set of "not equal"
filters (ie filters where a field is not equal to a certain value). I
created a pulpcore issue[0] to investigate whether pulpcore could provide
this functionality and it seems there are a few different options. I wanted
to ask for feedback though as this would affect the user experience and
thus whatever option we choose would be permanent.

There are three options:

1. First there is a package which adds functionality on top of
django-rest-framework-filters[1] which dynamically provides filters for
every field using ! (eg name!=value, state!=value). The problem is that the
package doesn't look like it's well maintained[2] and we'd quickly run into
problems when we try to upgrade to django 3 for example[3]. We'd probably
have to fork the project or take over ownership somehow.

2. The second solution is that we can try to import the code from
django-rest-framework-filters that creates these dynamic filters. This
would free us from having to support any other features
from django-rest-framework-filters we don't want to support.

3. The third option is to create a django scope (ie "ne") that would allow
plugin writers to manually define filters like "name__eq=value". This
solution seems the most verbose/explicit/straightforward but also the most
work for plugin writers. I have a couple PRs open to demonstrate this
solution:

https://github.com/pulp/pulp_rpm/pull/1559
https://github.com/pulp/pulpcore/pull/452

I'll try to move forward with a solution next week. Feedback before then
would be much appreciated.

[0] https://pulp.plan.io/issues/5854
[1] https://github.com/philipn/django-rest-framework-filters
[2] https://github.com/philipn/django-rest-framework-filters/issues/324 and
https://github.com/philipn/django-rest-framework-filters/issues/287
[3] https://github.com/philipn/django-rest-framework-filters/issues/326

David
_______________________________________________
Pulp-dev mailing list
Pulp-dev@redhat.com
https://www.redhat.com/mailman/listinfo/pulp-dev

Reply via email to