graphql-python / graphql-python/graphene-django
Filter class filtering broken with django-filter 2.0
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 760
- PR merge metrics
- No merged PRs in 30d
Description
While using any of the examples [listed here](https://docs.graphene-python.org/projects/django/en/latest/filtering/#custom-filtersets), this error is thrown by `django-filter`:
AssertionError: The `lookup_expr` argument no longer accepts `None` or a list of expressions. Use the `LookupChoiceFilter` instead. See: https://django-filter.readthedocs.io/en/master/guide/migration.html
Then if I, as they suggest, change `lookup_exp` to use `LookupChoiceFilter` instead. Like so:
class UserFilter(django_filters.FilterSet):
name = django_filters.LookupChoiceFilter(
field_class=forms.CharField,
lookup_choices=[
('exact', 'Equals'),
]
)
class Meta:
model = User
fields = ['name']
Then my `name` filter shows up as `name` in the schema instead of expected `name_Exact`. GraphQL allows me to pass the `name` parameter, but as expected no filtering is done.
Contributor guide
Assessment
This issue has not been assessed yet.