Replies: 1 comment 3 replies
-
Hi, thanks for using the library!
The reasoning stated in the custom FilterSet is as follows: # Override the default `qs` property to include this.
# It's needed to ensure that the `queryset._result_cache`
# is not cleared when using `queryset.all()`
qs = maybe_queryset(self.queryset) What this means is that this line in the original FilterSet is However, removing this doesn't seem to do anything based on my testing at present. This custom queryset was added pretty early in development, so perhaps something has changed in the details of the implementation so that this is no longer needed. I'm not 100% sure though. I might remove the custom filterset in the future based on this, but to answer you question: No, I don't think you need to reimplement it in your subclass.
I haven't tested filtering with this library (I have my own implementation for a similar thing in graphene-django-extensions), but likely |
Beta Was this translation helpful? Give feedback.
-
I'm working on a project that's happily been using this library (GDQO) to optimize away N+1 queries.
We are exploring options for adding more sophisticated filtering and are wondering how feasible it is to use this library in conjunction with graphene-django-filter.
Thanks to this library's DEFAULT_FILTERSET_CLASS setting, I was able to specify that I wanted to use
GRAPHQL_QUERY_OPTIMIZER = { "DEFAULT_FILTERSET_CLASS": "graphene_django_filter.AdvancedFilterSet" }
and things seem to continue to work.I do have a few other unanswered questions, though:
qs
method on the AdvancedFilterSet class, as is done in this library's FilterSet subclass?Our old GDQO-compatible order_by feature does not work as-is. I've been digging into this a bit and it's not clear to me how that was ever working but it seems like GDQO was automatically applying the ordering argument when present. Our previous approach was as follows:(It's since been pointed out to me that this behavior is explicitly introduced elsewhere in a set of app-specific GDQO extensions -- I will need to review this implementation and follow up.)... which is very confusing because the filter set for SomeOtherNode was not modified. (This may also relate to the previous point.)
So, to summarize, I'm initially wondering if there's any fundamental reason that this won't work and if anyone else has attempted it. Also, if anyone has suggestions about how I might get our order_by filter working again.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions