adding the option of defining a filterset_class in the Meta class

This commit is contained in:
Elena 2017-01-23 17:40:07 -08:00
parent e77962bb0a
commit 9b1c1b4bad
2 changed files with 7 additions and 2 deletions

View File

@ -48,7 +48,11 @@ class DjangoFilterConnectionField(DjangoConnectionField):
@property
def filterset_class(self):
return get_filterset_class(self._filterset_class, **self.meta)
if self.node_type()._meta.filterset_class:
filterset_class = self.node_type()._meta.filterset_class
else:
filterset_class = get_filterset_class(self._filterset_class, **self.meta)
return filterset_class
@property
def filtering_args(self):

View File

@ -58,7 +58,8 @@ class DjangoObjectTypeMeta(ObjectTypeMeta):
only_fields=(),
exclude_fields=(),
interfaces=(),
registry=None
registry=None,
filterset_class=None
)
if DJANGO_FILTER_INSTALLED:
# In case Django filter is available, then