<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 29, 2020 at 10:03 AM David Davis <<a href="mailto:daviddavis@redhat.com">daviddavis@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">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.<div><br></div><div>There are three options:</div><div><br></div><div>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.</div></div></blockquote><div>I default to this choice because even though it's not code that is in our control and that can feel uncomfortable, they wrote it and it does what we need. If it doesn't work out we can go with other options later.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>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.</div><div><br></div><div>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:</div><div><br></div><div><a href="https://github.com/pulp/pulp_rpm/pull/1559" target="_blank">https://github.com/pulp/pulp_rpm/pull/1559</a><br></div><div><a href="https://github.com/pulp/pulpcore/pull/452" target="_blank">https://github.com/pulp/pulpcore/pull/452</a><br></div><div><br></div><div>I'll try to move forward with a solution next week. Feedback before then would be much appreciated.</div><div><div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br></div><div>[0] <a href="https://pulp.plan.io/issues/5854" target="_blank">https://pulp.plan.io/issues/5854</a></div><div>[1] <a href="https://github.com/philipn/django-rest-framework-filters" target="_blank">https://github.com/philipn/django-rest-framework-filters</a></div><div>[2] <a href="https://github.com/philipn/django-rest-framework-filters/issues/324" target="_blank">https://github.com/philipn/django-rest-framework-filters/issues/324</a> and <a href="https://github.com/philipn/django-rest-framework-filters/issues/287" target="_blank">https://github.com/philipn/django-rest-framework-filters/issues/287</a></div><div>[3] <a href="https://github.com/philipn/django-rest-framework-filters/issues/326" target="_blank">https://github.com/philipn/django-rest-framework-filters/issues/326</a></div><div><br></div><div>David<br></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
</blockquote></div></div>