mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 12:16:58 +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)
|
||||
|
||||
def get_filterset_kwargs(self, filterset_class):
|
||||
kwargs = {'data': self.args or None}
|
||||
try:
|
||||
kwargs.update({
|
||||
'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)
|
||||
kwargs = {
|
||||
'data': self.args or None,
|
||||
'queryset': self.get_manager()
|
||||
}
|
||||
return kwargs
|
||||
|
|
Loading…
Reference in New Issue
Block a user