コード例 #1
0
class PostOutSchema(Schema):
    id = Integer()
    title = String()
    content = String()
    coins = Integer()
    private = Boolean()
    author = Nested(PublicUserOutSchema)
    comments = List(Nested(CommentOutSchema, exclude=("post", )))
    columns = List(Nested(ColumnOutSchema, exclude=("posts", "author")))
    self = ma.URLFor(".post", values=dict(post_id="<id>"))
コード例 #2
0
class CommentOutSchema(Schema):
    id = Integer()
    body = String()
    author = Nested(PublicUserOutSchema)
    post = Nested(lambda: PostOutSchema(only=(
        "id",
        "title",
        "self",
    )))
    replying = Nested(lambda: CommentOutSchema(exclude=("replying", )))
    self = ma.URLFor(".comment", values=dict(comment_id="<id>"))
コード例 #3
0
ファイル: app.py プロジェクト: zylhub/apiflask
class PetsOutSchema(Schema):
    pets = List(Nested(PetOutSchema))
    pagination = Nested(PaginationSchema)
コード例 #4
0
class GroupOutSchema(Schema):
    name = String()
    members = List(Nested(PublicUserOutSchema))
    manager = Nested(PublicUserOutSchema)
    private = Boolean()
コード例 #5
0
class NotificationOutSchema(Schema):
    id = Integer()
    message = String()
    receiver = Nested(PublicUserOutSchema)
    timestamp = DateTime()
コード例 #6
0
class ColumnOutSchema(Schema):
    id = Integer()
    name = String()
    author = Nested(PublicUserOutSchema)
    posts = List(Nested(lambda: PostOutSchema(only=("id", "title", "self"))))
    self = ma.URLFor(".column", values=dict(column_id="<id>"))