|
3 | 3 | from sqlalchemy.orm import scoped_session, sessionmaker
|
4 | 4 |
|
5 | 5 | import graphene
|
6 |
| -from graphene.relay import Node |
| 6 | +from graphene.relay import Connection, Node |
7 | 7 |
|
8 | 8 | from ..registry import reset_global_registry
|
9 | 9 | from ..fields import SQLAlchemyConnectionField
|
@@ -153,7 +153,7 @@ class Meta:
|
153 | 153 | # def get_node(cls, id, info):
|
154 | 154 | # return Article(id=1, headline='Article node')
|
155 | 155 |
|
156 |
| - class ArticleConnection(graphene.relay.Connection): |
| 156 | + class ArticleConnection(Connection): |
157 | 157 | class Meta:
|
158 | 158 | node = ArticleNode
|
159 | 159 |
|
@@ -243,7 +243,7 @@ class Meta:
|
243 | 243 | model = Editor
|
244 | 244 | interfaces = (Node, )
|
245 | 245 |
|
246 |
| - class EditorConnection(graphene.relay.Connection): |
| 246 | + class EditorConnection(Connection): |
247 | 247 | class Meta:
|
248 | 248 | node = EditorNode
|
249 | 249 |
|
@@ -394,16 +394,20 @@ class Meta:
|
394 | 394 | model = Pet
|
395 | 395 | interfaces = (Node, )
|
396 | 396 |
|
| 397 | + class PetConnection(Connection): |
| 398 | + class Meta: |
| 399 | + node = PetNode |
| 400 | + |
397 | 401 | class Query(graphene.ObjectType):
|
398 |
| - defaultSort = SQLAlchemyConnectionField(PetNode) |
399 |
| - nameSort = SQLAlchemyConnectionField(PetNode) |
400 |
| - multipleSort = SQLAlchemyConnectionField(PetNode) |
401 |
| - descSort = SQLAlchemyConnectionField(PetNode) |
| 402 | + defaultSort = SQLAlchemyConnectionField(PetConnection) |
| 403 | + nameSort = SQLAlchemyConnectionField(PetConnection) |
| 404 | + multipleSort = SQLAlchemyConnectionField(PetConnection) |
| 405 | + descSort = SQLAlchemyConnectionField(PetConnection) |
402 | 406 | singleColumnSort = SQLAlchemyConnectionField(
|
403 |
| - PetNode, sort=graphene.Argument(sort_enum_for_model(Pet))) |
| 407 | + PetConnection, sort=graphene.Argument(sort_enum_for_model(Pet))) |
404 | 408 | noDefaultSort = SQLAlchemyConnectionField(
|
405 |
| - PetNode, sort=sort_argument_for_model(Pet, False)) |
406 |
| - noSort = SQLAlchemyConnectionField(PetNode, sort=None) |
| 409 | + PetConnection, sort=sort_argument_for_model(Pet, False)) |
| 410 | + noSort = SQLAlchemyConnectionField(PetConnection, sort=None) |
407 | 411 |
|
408 | 412 | query = '''
|
409 | 413 | query sortTest {
|
|
0 commit comments