mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-14 05:36:45 +03:00
Simplifying get_filterset_kwargs() as ImproperlyConfigured cannot be raised
This commit is contained in:
parent
930f7179d0
commit
b9f93918c8
|
@ -73,18 +73,8 @@ class FilterConnectionResolver(BaseQuerySetConnectionResolver):
|
||||||
return filterset_class(**kwargs)
|
return filterset_class(**kwargs)
|
||||||
|
|
||||||
def get_filterset_kwargs(self, filterset_class):
|
def get_filterset_kwargs(self, filterset_class):
|
||||||
kwargs = {'data': self.args or None}
|
kwargs = {
|
||||||
try:
|
'data': self.args or None,
|
||||||
kwargs.update({
|
'queryset': self.get_manager()
|
||||||
'queryset': self.get_manager(),
|
}
|
||||||
})
|
|
||||||
except ImproperlyConfigured:
|
|
||||||
# ignore the error here if the filterset has a model defined
|
|
||||||
# to acquire a queryset from
|
|
||||||
if filterset_class._meta.model is None:
|
|
||||||
msg = ("'%s' does not define a 'model' and the resolver '%s' "
|
|
||||||
"does not return a valid queryset from 'get_queryset'. "
|
|
||||||
"You must fix one of them.")
|
|
||||||
args = (filterset_class.__name__, self.__class__.__name__)
|
|
||||||
raise ImproperlyConfigured(msg % args)
|
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
Loading…
Reference in New Issue
Block a user