Graphene-django: No request passed to custom filter as self.request

Created on 19 Feb 2018  路  9Comments  路  Source: graphql-python/graphene-django

Hi,

I could be doing something wrong or else this is a bug.

When creating a custom filter and I override the queryset as per the Filtering docs:

   @property
    def qs(self):
        # The query context can be found in self.request.
        print(self.request.user)
        return super(CustomFilter, self)

self.request is always None

馃悰bug

Most helpful comment

Hey @syrusakbary any chance this could be released? It feels like a pretty major blocker (certainly is for our use case of filtering a list for a logged in user), and installing from master breaks a lot of Python packaging workflows, not to mention means that other unreleased and possibly untested code might be used in production.

All 9 comments

I have the same issue

It's working for me now, I've just updated the version to 2.0

I am on version 2. Could you please give an example of how you got it to work?

In my case, I was using DjangoFilterConnectionField, and I could see that it's connection_resolver method wasn't supplying the request parameter. If you look at the master branch, you can see that the request object was just added as a parameter in 1db1cbdd9. I don't know why, but the latest version in PyPI is 2.0.0, which doesn't include that commit. It seems as though we're due for a release, but I can't find any tickets saying when.

Great thanks, yes it does seem like there has been a lot of work done since the last release. Looking forward to the update...

Ok, using the master branch seems to fix things as stated,

Hey @syrusakbary any chance this could be released? It feels like a pretty major blocker (certainly is for our use case of filtering a list for a logged in user), and installing from master breaks a lot of Python packaging workflows, not to mention means that other unreleased and possibly untested code might be used in production.

Just experienced this .

django-filter == 2.2.0
django-graphene == 2.13.0

Nvm, user error, fix still applies.

Was this page helpful?
0 / 5 - 0 ratings