Closed ericdoerheit closed 1 year ago
Hi @ericdoerheit and thank you.
You are correct that these fields are not directly used by the library, but still they may be / are of use to various implementations. For example, data from self._request
could be useful for custom filters (or some other customizations). One of the examples that is used by me: query adjustment based on the auth type from self._request.auth
in some DRF API. But there are more: like using some headers, META, etc.
The same idea is applied to the self._view
.
Hi @maxipavlovic,
thank you very much for your profound answer!
Hello django-rql contributors,
First of all: thank you so much for all your hard work!
We are using django-rql, and we just recently tried to use RQL outside a view without a request object and a view object as we thought it should be possible because a query string should be enough to return the correct queryset. Looking at the code of the
RQLFilterClass
, we saw that the two attributesself._request
andself._view
are set, but they seem to be unused, which is good for the aforementioned use case.I'm wondering if I just overlooked it, or if they are indeed not used? In that case, would it make sense to remove those attributes and maybe even remove the keyword arguments from
def apply_filters(self, query, request=None, view=None)
?