{"action":"created","issue":{"url":"https://api.github.com/repos/graphql-python/graphene-django/issues/90","repository_url":"https://api.github.com/repos/graphql-python/graphene-django","labels_url":"https://api.github.com/repos/graphql-python/graphene-django/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/graphql-python/graphene-django/issues/90/comments","events_url":"https://api.github.com/repos/graphql-python/graphene-django/issues/90/events","html_url":"https://github.com/graphql-python/graphene-django/issues/90","id":200941011,"number":90,"title":"DjangoFilterConnectionField seems to disregard filtered queryset","user":{"login":"jole78","id":2247346,"avatar_url":"https://avatars2.githubusercontent.com/u/2247346?v=3","gravatar_id":"","url":"https://api.github.com/users/jole78","html_url":"https://github.com/jole78","followers_url":"https://api.github.com/users/jole78/followers","following_url":"https://api.github.com/users/jole78/following{/other_user}","gists_url":"https://api.github.com/users/jole78/gists{/gist_id}","starred_url":"https://api.github.com/users/jole78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jole78/subscriptions","organizations_url":"https://api.github.com/users/jole78/orgs","repos_url":"https://api.github.com/users/jole78/repos","events_url":"https://api.github.com/users/jole78/events{/privacy}","received_events_url":"https://api.github.com/users/jole78/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-16T06:34:27Z","updated_at":"2017-03-17T08:48:23Z","closed_at":null,"body":"Given the following code:\r\n\r\n```python\r\nclass Report(DjangoObjectType):\r\n\tclass Meta:\r\n\t\tmodel = ReportModel\r\n\t\tinterfaces = (graphene.Node, )\r\n\t\tfilter_fields = {\r\n\t\t\t'state': ['exact'],\r\n\t\t}\r\n\r\nclass Query(graphene.AbstractType):\r\n\treports = DjangoFilterConnectionField(Report)\r\n\r\n\tdef resolve_reports(self, args, context, info):\r\n\t\treturn ReportModel.objects.filter(created_by=context.user)\r\n```\r\n\r\nWhen I issue the following query:\r\n\r\n```\r\n{\r\n  reports(state: \"draft\") {\r\n    edges {\r\n      node {\r\n        id\r\n        state        \r\n      }\r\n    }\r\n  }\r\n  __debug {\r\n    sql {\r\n      raw_sql\r\n      params\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nI get the following:\r\n\r\n```\r\n          \"raw_sql\": \"SELECT COUNT(*) AS \\\"__count\\\" FROM \\\"myapp_report\\\" WHERE \\\"myapp_report\\\".\\\"created_by_id\\\" = %s\",\r\n          \"params\": \"[3]\"\r\n```\r\n\r\nYou can see that it disregards the filter altogether. \r\n\r\nHowever, if I remove this from the the query:\r\n```python\r\n\tdef resolve_reports(self, args, context, info):\r\n\t\treturn ReportModel.objects.filter(created_by=context.user)\r\n```\r\n\r\nI get the desired result, but then the query is not filtered by user access any more.\r\n\r\nResult:\r\n```\r\n      \"sql\": [\r\n        {\r\n          \"raw_sql\": \"SELECT COUNT(*) AS \\\"__count\\\" FROM \\\"myapp_report\\\" WHERE \\\"myapp_report\\\".\\\"state\\\" = %s\",\r\n          \"params\": \"[\\\"draft\\\"]\"\r\n        },\r\n```\r\n\r\nAm I doing something wrong here or is it a bug? Please advise.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/graphql-python/graphene-django/issues/comments/287298998","html_url":"https://github.com/graphql-python/graphene-django/issues/90#issuecomment-287298998","issue_url":"https://api.github.com/repos/graphql-python/graphene-django/issues/90","id":287298998,"user":{"login":"crucialfelix","id":218738,"avatar_url":"https://avatars2.githubusercontent.com/u/218738?v=3","gravatar_id":"","url":"https://api.github.com/users/crucialfelix","html_url":"https://github.com/crucialfelix","followers_url":"https://api.github.com/users/crucialfelix/followers","following_url":"https://api.github.com/users/crucialfelix/following{/other_user}","gists_url":"https://api.github.com/users/crucialfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/crucialfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crucialfelix/subscriptions","organizations_url":"https://api.github.com/users/crucialfelix/orgs","repos_url":"https://api.github.com/users/crucialfelix/repos","events_url":"https://api.github.com/users/crucialfelix/events{/privacy}","received_events_url":"https://api.github.com/users/crucialfelix/received_events","type":"User","site_admin":false},"created_at":"2017-03-17T08:48:23Z","updated_at":"2017-03-17T08:48:23Z","body":"Duplicate of https://github.com/graphql-python/graphene-django/issues/30\r\n\r\nfix not yet released"}}
{"actor":{"display_login":"crucialfelix"}}