Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
class QueryRoot(graphene.ObjectType):
    articles = NdbConnectionField(ArticleType)
Beispiel #4
0
 def test_connectionField_model(self):
     self.assertEqual(NdbConnectionField(CommentType).model, Comment)