mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 17:52:19 +03:00
Add optimization to DjangoFieldList
This commit is contained in:
parent
73f4d4950e
commit
34e6a90df8
|
@ -24,7 +24,12 @@ class DjangoListField(Field):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def list_resolver(resolver, root, args, context, info):
|
def list_resolver(resolver, root, args, context, info):
|
||||||
return maybe_queryset(resolver(root, args, context, info))
|
qs = maybe_queryset(resolver(root, args, context, info))
|
||||||
|
|
||||||
|
if isinstance(qs, QuerySet):
|
||||||
|
qs = optimize_queryset(qs.model, qs, info.field_asts[0])
|
||||||
|
|
||||||
|
return qs
|
||||||
|
|
||||||
def get_resolver(self, parent_resolver):
|
def get_resolver(self, parent_resolver):
|
||||||
return partial(self.list_resolver, parent_resolver)
|
return partial(self.list_resolver, parent_resolver)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user