Use adapters instead of Connection and PageInfo

This commit is contained in:
Tomasz Kontusz 2019-09-15 16:31:12 +02:00 committed by Jean-Louis Fuchs
parent a62cee751f
commit a0e31c5be6
No known key found for this signature in database
GPG Key ID: 3440F981335FD30F

View File

@ -1,13 +1,12 @@
from functools import partial from functools import partial
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from graphene import NonNull
from graphene.relay import ConnectionField
from graphene.types import Field, List
from graphql_relay.connection.arrayconnection import connection_from_list_slice from graphql_relay.connection.arrayconnection import connection_from_list_slice
from promise import Promise from promise import Promise
from graphene import NonNull
from graphene.relay import ConnectionField, PageInfo
from graphene.types import Field, List
from .settings import graphene_settings from .settings import graphene_settings
from .utils import maybe_queryset from .utils import maybe_queryset
@ -128,9 +127,9 @@ class DjangoConnectionField(ConnectionField):
slice_start=0, slice_start=0,
list_length=_len, list_length=_len,
list_slice_length=_len, list_slice_length=_len,
connection_type=connection, connection_type=partial(connection_adapter, connection),
edge_type=connection.Edge, edge_type=connection.Edge,
pageinfo_type=PageInfo, pageinfo_type=page_info_adapter,
) )
connection.iterable = iterable connection.iterable = iterable
connection.length = _len connection.length = _len