mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-26 11:33:44 +03:00
adding the option of defining a filterset_class in the Meta class
This commit is contained in:
parent
e77962bb0a
commit
9b1c1b4bad
|
@ -48,7 +48,11 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def filterset_class(self):
|
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
|
@property
|
||||||
def filtering_args(self):
|
def filtering_args(self):
|
||||||
|
|
|
@ -58,7 +58,8 @@ class DjangoObjectTypeMeta(ObjectTypeMeta):
|
||||||
only_fields=(),
|
only_fields=(),
|
||||||
exclude_fields=(),
|
exclude_fields=(),
|
||||||
interfaces=(),
|
interfaces=(),
|
||||||
registry=None
|
registry=None,
|
||||||
|
filterset_class=None
|
||||||
)
|
)
|
||||||
if DJANGO_FILTER_INSTALLED:
|
if DJANGO_FILTER_INSTALLED:
|
||||||
# In case Django filter is available, then
|
# In case Django filter is available, then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user