mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-14 05:36:45 +03:00
change page_info to fit relay's limitation
This commit is contained in:
parent
0345fa41ef
commit
14fbfaa427
|
@ -18,15 +18,23 @@ from .fields import GlobalIDField
|
||||||
|
|
||||||
|
|
||||||
class PageInfo(ObjectType):
|
class PageInfo(ObjectType):
|
||||||
has_next_page = Boolean(
|
|
||||||
|
def __init__(self, start_cursor="", end_cursor="",
|
||||||
|
has_previous_page=False, has_next_page=False):
|
||||||
|
self.startCursor = start_cursor
|
||||||
|
self.endCursor = end_cursor
|
||||||
|
self.hasPreviousPage = has_previous_page
|
||||||
|
self.hasNextPage = has_next_page
|
||||||
|
|
||||||
|
hasNextPage = Boolean(
|
||||||
required=True,
|
required=True,
|
||||||
description='When paginating forwards, are there more items?')
|
description='When paginating forwards, are there more items?')
|
||||||
has_previous_page = Boolean(
|
hasPreviousPage = Boolean(
|
||||||
required=True,
|
required=True,
|
||||||
description='When paginating backwards, are there more items?')
|
description='When paginating backwards, are there more items?')
|
||||||
start_cursor = String(
|
startCursor = String(
|
||||||
description='When paginating backwards, the cursor to continue.')
|
description='When paginating backwards, the cursor to continue.')
|
||||||
end_cursor = String(
|
endCursor = String(
|
||||||
description='When paginating forwards, the cursor to continue.')
|
description='When paginating forwards, the cursor to continue.')
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,10 +57,15 @@ class Edge(ObjectType):
|
||||||
|
|
||||||
class Connection(ObjectType):
|
class Connection(ObjectType):
|
||||||
'''A connection to a list of items.'''
|
'''A connection to a list of items.'''
|
||||||
|
|
||||||
|
def __init__(self, edges, page_info):
|
||||||
|
self.edges = edges
|
||||||
|
self.pageInfo = page_info
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
type_name = 'DefaultConnection'
|
type_name = 'DefaultConnection'
|
||||||
|
|
||||||
page_info = Field(PageInfo, required=True,
|
pageInfo = Field(PageInfo, required=True,
|
||||||
description='The Information to aid in pagination')
|
description='The Information to aid in pagination')
|
||||||
|
|
||||||
_connection_data = None
|
_connection_data = None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user