Esempio n. 1
0
class TagSchema(Schema):
    id = Integer(dump_only=True)
    created_at = DateTime(dump_only=True)
    updated_at = DateTime(dump_only=True)

    author = Function(lambda o: o.user.username)
    tag = String(strip=True, validate=Length(max=16))
Esempio n. 2
0
class PostSchema(Schema):
    id = Integer(dump_only=True)
    created_at = DateTime(dump_only=True)
    updated_at = DateTime(dump_only=True)

    author = Function(lambda o: o.user.username)
    title = String(required=True,
                   strip=True,
                   validate=[NotEmpty(), Length(min=1, max=32)])
    sub = String(required=True, strip=True, validate=Length(max=128))
    content = String(required=True, validate=NotEmpty())

    statuses = Nested(StatusSchema,
                      only=('created_at', 'status'),
                      many=True,
                      dump_only=True)
    comments = Nested(CommentSchema, many=True, dump_only=True)
    tags = Nested(StatusSchema, only=('tag', ), many=True, dump_only=True)
Esempio n. 3
0
class SampleSchema(Schema):
    name = String(validate=NotEmpty())
Esempio n. 4
0
 class TestSchema2(Schema):
     name = String(strip=True, validate=NotEmpty())
Esempio n. 5
0
 class TestSchema(Schema):
     name = String()
Esempio n. 6
0
 class TestSchema(Schema):
     name = String(strip=True)