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>"))
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>"))
class PetsOutSchema(Schema): pets = List(Nested(PetOutSchema)) pagination = Nested(PaginationSchema)
class GroupOutSchema(Schema): name = String() members = List(Nested(PublicUserOutSchema)) manager = Nested(PublicUserOutSchema) private = Boolean()
class NotificationOutSchema(Schema): id = Integer() message = String() receiver = Nested(PublicUserOutSchema) timestamp = DateTime()
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>"))