Graphene-django: Graphene Django is incompatible with django-filters 2.0.0

Created on 13 Jul 2018  路  8Comments  路  Source: graphql-python/graphene-django

When using graphene-django along with django-filter 2.0.0 I get an error trying to use the graphql endpoint.

A brief example:

class Query(object):
    projects = DjangoFilterConnectionField(
        MyProjectNode, filterset_class=MyProjectFilterSet)

This is the error:

`GrapheneMyProjectFilterSet.filter_for_reverse_field` has been removed. `GrapheneMyProjectFilterSet.filter_for_field` now generates filters for reverse fields. See: https://django-filter.readthedocs.io/en/master/guide/migration.html

All 8 comments

I'm hitting this too after installing latest "Django REST framework JWT" in my project.

Same thing here.

Same thing here!

Same thing here. Downgrade to django-filter==1.1.0 resolve the problem.

This actually prevents a django 2.1 upgrade, as Django 2.1 requires django-filters to be bumped to 2.0:

  File "/Users/paul.hallet/Envs/pgm-models/lib/python3.6/site-packages/django_filters/__init__.py", line 7, in <module>
    from .filterset import FilterSet
  File "/Users/paul.hallet/Envs/pgm-models/lib/python3.6/site-packages/django_filters/filterset.py", line 15, in <module>
    from .filters import (
  File "/Users/paul.hallet/Envs/pgm-models/lib/python3.6/site-packages/django_filters/filters.py", line 9, in <module>
    from django.db.models.sql.constants import QUERY_TERMS
ImportError: cannot import name 'QUERY_TERMS'

This is with the following requirements:

Django==2.1.0
graphene-django==2.1.0
django-filter==1.1.0

I've run into the same issue: I want to use graphene-django with filtering capabilities in django==2.1.1 (the latest as of today).

Could someone please let me know if this is an immediate concern in the pipeline? If not, I would be happy to take this up and pitch in!

Thank you. Django 2.1 here I come.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MythicManiac picture MythicManiac  路  3Comments

MilanRgm picture MilanRgm  路  3Comments

eyalch picture eyalch  路  3Comments

flame0 picture flame0  路  4Comments

timothyjlaurent picture timothyjlaurent  路  3Comments