Following documentation, I am trying to add filtering, but I got this error:
Setting 'Meta.model' without either 'Meta.fields' or 'Meta.exclude' has been deprecated since 0.15.0 and is now disallowed. Add an explicit 'Meta.fields' or 'Meta.exclude' to the SerialFilterSet class.
My requrements:
Django==2.1.2
django-filter==2.0.0
graphene==2.1.3
graphene-django==2.2.0
graphql-core==2.1
graphql-relay==0.4.5
my scheme
import graphene
from graphene import relay, ObjectType
from graphene_django.types import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from movie.models import Movie, Genre, Serial
class MovieNode(DjangoObjectType):
class Meta:
model = Movie
interfaces = (relay.Node,)
filter_fields = {
'title_ru': ['exact', 'icontains', 'istartswith'],
}
class Query(object):
movie = relay.Node.Field(MovieNode)
all_movies = DjangoFilterConnectionField(MovieNode)
Can you help me with this problem?
The error you are posting is somehow referred to the "SerialFilterSet" class. Is there any other part of your schema you didn't pasted?
Related with the "Serial" model perhaps?
I think it has something to do with this issue of django-filter and the adoption of version 2 of the library.
https://github.com/carltongibson/django-filter/issues/504
At the mean time, did you tried to use a Custom Filterset to see if the error persists?
Also faced this problem.
Make sure you have filter_fields (empty tuple works too) in every Node that defined as DjangoFilterConnectionField in your Query.
Most likely, you are missing it in SerialNode.
You may come up with creating something like
class MyMeta:
filter_fields = ()
interfaces = (relay.Node, )
and then
class SerialNode(DjangoObjectType):
class Meta(MyMeta):
model = Serial
# no filters here
Thanks, @defiler. Did you reach a resolution @flame0?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Also faced this problem.
Make sure you have filter_fields (empty tuple works too) in every Node that defined as DjangoFilterConnectionField in your Query.
Most likely, you are missing it in SerialNode.
You may come up with creating something like
and then