class ArticleType(NdbObjectType): class Meta: model = Article interfaces = (Node, ) comments = NdbConnectionField(CommentType) readers = NdbConnectionField(ReaderType, transform_edges=transform_to_reader_edges) def resolve_comments(self, info): return Comment.query(ancestor=self.key) def resolve_readers(self, info, **args): return ArticleReader.query().filter( ArticleReader.article_key == self.key).order(ArticleReader.key)
class ArticleType(NdbObjectType): class Meta: model = Article interfaces = (Node,) comments = NdbConnectionField(CommentType) @resolve_only_args def resolve_comments(self): return Comment.query(ancestor=self.key)
class QueryRoot(graphene.ObjectType): articles = NdbConnectionField(ArticleType)
def test_connectionField_model(self): self.assertEqual(NdbConnectionField(CommentType).model, Comment)