From 2c1973c1f3c9a797886f1d1ec3e26fb44deb1053 Mon Sep 17 00:00:00 2001 From: Ernesto Perez Amigo Date: Mon, 2 Oct 2017 21:10:43 -0500 Subject: [PATCH] Fixed bug in the queryset_factory function because it did not always return a queryset --- graphene_django_extras/__init__.py | 2 +- graphene_django_extras/fields.py | 8 ++++---- graphene_django_extras/utils.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/graphene_django_extras/__init__.py b/graphene_django_extras/__init__.py index 219b558..4e5ae21 100644 --- a/graphene_django_extras/__init__.py +++ b/graphene_django_extras/__init__.py @@ -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) diff --git a/graphene_django_extras/fields.py b/graphene_django_extras/fields.py index 4f0b9e2..6ff9cb4 100644 --- a/graphene_django_extras/fields.py +++ b/graphene_django_extras/fields.py @@ -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): @@ -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): @@ -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): @@ -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} diff --git a/graphene_django_extras/utils.py b/graphene_django_extras/utils.py index e1fe341..1d55233 100644 --- a/graphene_django_extras/utils.py +++ b/graphene_django_extras/utils.py @@ -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()