Skip to content

Commit

Permalink
Fixed bug in the queryset_factory function because it did not always …
Browse files Browse the repository at this point in the history
…return a queryset
  • Loading branch information
Ernesto Perez Amigo committed Oct 3, 2017
1 parent 78ab2e4 commit 2c1973c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion graphene_django_extras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .pagination import LimitOffsetGraphqlPagination, PageGraphqlPagination, CursorGraphqlPagination
from .types import DjangoObjectType, DjangoInputObjectType, DjangoListObjectType

VERSION = (0, 0, 1, 'beta', 9)
VERSION = (0, 0, 1, 'beta', 10)

__version__ = get_version(VERSION)

Expand Down
8 changes: 4 additions & 4 deletions graphene_django_extras/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def list_resolver1(manager, filterset_class, filtering_args, root, info, **kwarg
qs = find_field(info.field_asts[0], root._prefetched_objects_cache)

if not qs:
qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs).get_queryset()
qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs)
qs = filterset_class(data=filter_kwargs, queryset=qs).qs

if root and is_valid_django_model(root._meta.model):
Expand Down Expand Up @@ -117,7 +117,7 @@ def list_resolver(manager, filterset_class, filtering_args, root, info, **kwargs
qs = None

if not qs:
qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs).get_queryset()
qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs)
qs = filterset_class(data=filter_kwargs, queryset=qs).qs

if root and is_valid_django_model(root._meta.model):
Expand Down Expand Up @@ -173,7 +173,7 @@ def model(self):
def list_resolver(self, manager, filterset_class, filtering_args,
root, info, **kwargs):

qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs).get_queryset()
qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs)
qs = filterset_class(data=filter_kwargs, queryset=qs).qs

if root and is_valid_django_model(root._meta.model):
Expand Down Expand Up @@ -229,7 +229,7 @@ def model(self):

def list_resolver(self, manager, filterset_class, filtering_args, root, info, **kwargs):

qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs).get_queryset()
qs = queryset_factory(manager, info.field_asts, info.fragments, **kwargs)

filter_kwargs = {k: v for k, v in kwargs.items() if k in filtering_args}

Expand Down
2 changes: 1 addition & 1 deletion graphene_django_extras/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ def queryset_factory(manager, fields_asts=None, fragments=None, **kwargs):
return manager.prefetch_related(*prefetch_related)
elif select_related and not prefetch_related:
return manager.select_related(*select_related)
return manager
return manager.get_queryset()

0 comments on commit 2c1973c

Please sign in to comment.