Repository: graphql-python/graphene-django

Issue:
request not being passed to filterclass
given the following code:
```
class ManageQuery(AbstractType):
    group_requests = DjangoFilterConnectionField(RequestNode, filterset_class=RequestManageFilter)
```
and the filterset class:
```
class RequestManageFilter(FilterSet):
    # Do case-insensitive lookups on 'name'

    @property
    def qs(self):
        user = getattr(self.request, 'user', None)
        print('User: ', user)
        parent = super(RequestManageFilter, self).qs
        return parent # .filter(group=self.request.user.main_author)

    class Meta:
        model = Request
        exclude = set()
```

the instance property self.request is always None, because when it's instantiated, graphene-django does not pass the context as request, shown here in fields.py's connection_resolver

```
   @classmethod
    def connection_resolver(cls, resolver, connection, default_manager, max_limit,
                            enforce_first_or_last, filterset_class, filtering_args,
                            root, args, context, info):
        filter_kwargs = {k: v for k, v in args.items() if k in filtering_args}

        qs = filterset_class(
            data=filter_kwargs,
            queryset=default_manager.get_queryset(),
        ).qs
```

passing request=context would make it work:
```
        qs = filterset_class(
            data=filter_kwargs,
            queryset=default_manager.get_queryset(),
            request=context,
        ).qs
```
request not being passed to filterclass
given the following code:
```
class ManageQuery(AbstractType):
    group_requests = DjangoFilterConnectionField(RequestNode, filterset_class=RequestManageFilter)
```
and the filterset class:
```
class RequestManageFilter(FilterSet):
    # Do case-insensitive lookups on 'name'

    @property
    def qs(self):
        user = getattr(self.request, 'user', None)
        print('User: ', user)
        parent = super(RequestManageFilter, self).qs
        return parent # .filter(group=self.request.user.main_author)

    class Meta:
        model = Request
        exclude = set()
```

the instance property self.request is always None, because when it's instantiated, graphene-django does not pass the context as request, shown here in fields.py's connection_resolver

```
   @classmethod
    def connection_resolver(cls, resolver, connection, default_manager, max_limit,
                            enforce_first_or_last, filterset_class, filtering_args,
                            root, args, context, info):
        filter_kwargs = {k: v for k, v in args.items() if k in filtering_args}

        qs = filterset_class(
            data=filter_kwargs,
            queryset=default_manager.get_queryset(),
        ).qs
```

passing request=context would make it work:
```
        qs = filterset_class(
            data=filter_kwargs,
            queryset=default_manager.get_queryset(),
            request=context,
        ).qs
```


Discussion:

Resolving patch:
diff --git a/graphene_django/filter/fields.py b/graphene_django/filter/fields.py
--- a/graphene_django/filter/fields.py
+++ b/graphene_django/filter/fields.py
@@ -73,7 +73,8 @@ def connection_resolver(cls, resolver, connection, default_manager, max_limit,
         filter_kwargs = {k: v for k, v in args.items() if k in filtering_args}
         qs = filterset_class(
             data=filter_kwargs,
-            queryset=default_manager.get_queryset()
+            queryset=default_manager.get_queryset(),
+            request=context
         ).qs
 
         return super(DjangoFilterConnectionField, cls).connection_resolver(


Test patch:
diff --git a/graphene_django/filter/tests/test_fields.py b/graphene_django/filter/tests/test_fields.py
--- a/graphene_django/filter/tests/test_fields.py
+++ b/graphene_django/filter/tests/test_fields.py
@@ -136,6 +136,48 @@ def test_filter_shortcut_filterset_extra_meta():
     assert 'headline' not in field.filterset_class.get_fields()
 
 
+def test_filter_shortcut_filterset_context():
+    class ArticleContextFilter(django_filters.FilterSet):
+
+        class Meta:
+            model = Article
+            exclude = set()
+
+        @property
+        def qs(self):
+            qs = super(ArticleContextFilter, self).qs
+            return qs.filter(reporter=self.request.reporter)
+
+    class Query(ObjectType):
+        context_articles = DjangoFilterConnectionField(ArticleNode, filterset_class=ArticleContextFilter)
+
+    r1 = Reporter.objects.create(first_name='r1', last_name='r1', email='r1@test.com')
+    r2 = Reporter.objects.create(first_name='r2', last_name='r2', email='r2@test.com')
+    Article.objects.create(headline='a1', pub_date=datetime.now(), reporter=r1, editor=r1)
+    Article.objects.create(headline='a2', pub_date=datetime.now(), reporter=r2, editor=r2)
+
+    class context(object):
+        reporter = r2
+
+    query = '''
+    query {
+        contextArticles {
+            edges {
+                node {
+                    headline
+                }
+            }
+        }
+    }
+    '''
+    schema = Schema(query=Query)
+    result = schema.execute(query, context_value=context())
+    assert not result.errors
+
+    assert len(result.data['contextArticles']['edges']) == 1
+    assert result.data['contextArticles']['edges'][0]['node']['headline'] == 'a2'
+
+
 def test_filter_filterset_information_on_meta():
     class ReporterFilterNode(DjangoObjectType):