コード例 #1
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class AddAdminParse(BaseMarshmallow):
    username = fields.String(validate=[validate.str_range(6, 16)], required=True)
    password = fields.String(validate=[validate.str_range(8, 16)], required=True)
    password_ = fields.String(validate=[validate.str_range(8, 16)], required=True)
    nickname = fields.String(validate=[validate.str_range(0, 32)], missing="admin")
    remark = fields.String(validate=[validate.str_range(0, 255)])
    image_id = fields.Integer(validate=[validate.image_exist])
コード例 #2
0
class UserRegisterParse(BaseMarshmallow):
    email = fields.Email(validate=[validate.str_range(0, 128)], required=True)
    password = fields.String(validate=[validate.str_range(8, 16)],
                             required=True)
    password_ = fields.String(validate=[validate.str_range(8, 16)],
                              required=True)
    code = fields.String(validate=[validate.str_range(6, 6)], required=True)
コード例 #3
0
class AddDownloadParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(0, 128)], required=True)
    description = fields.String()
    version = fields.String(validate=[validate.str_range(0, 64)])
    language = fields.String(validate=[validate.str_range(0, 128)])
    file_id = fields.Integer(validate=[validate.data_exist(Upload)],
                             required=True)
    category_id = fields.Integer(
        validate=[validate.category_exist("download")], required=True)
    cover_id = fields.Integer(validate=[validate.image_exist], required=True)
コード例 #4
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class AddArticleParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(1, 255)], required=True)
    content = fields.String()
    recom = fields.Boolean(missing=False)
    top = fields.Boolean(missing=False)
    published = fields.Boolean(missing=True)
    publish_date = fields.DateTime('%Y-%m-%d %H:%M')
    description = fields.String()
    cover_id = fields.Integer(validate=[validate.image_exist], required=True)
    category_id = fields.Integer(validate=[validate.category_exist("article")],
                                 required=True)
    tag_id = fields.List(fields.Integer(validate=[validate.data_exist(Tag)]))
コード例 #5
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class AddAlbumParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(0, 128)], required=True)
    description = fields.String()
    category_id = fields.Integer(validate=[validate.category_exist("picture")],
                                 required=True)
    cover_id = fields.Integer(validate=[validate.image_exist], required=True)
コード例 #6
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class AddTagParse(BaseMarshmallow):
    name = fields.String(validate=[validate.str_range(0, 128)], required=True)
    sort = fields.Integer(validate=[validate.positive], missing=20)
コード例 #7
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class AdminLoginParse(BaseMarshmallow):
    username = fields.String(validate=[validate.str_range(6, 16)], required=True)
    password = fields.String(validate=[validate.str_range(8, 16)], required=True)
コード例 #8
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class UpdateAdminInfoParse(BaseMarshmallow):
    password = fields.String(validate=[validate.str_range(8, 16)])
    password_ = fields.String(validate=[validate.str_range(8, 16)])
    nickname = fields.String(validate=[validate.str_range(0, 32)], missing="admin")
    remark = fields.String(validate=[validate.str_range(0, 255)])
    image_id = fields.Integer(validate=[validate.image_exist])
コード例 #9
0
class UserLoginParse(BaseMarshmallow):
    username = fields.Email(validate=[validate.str_range(0, 128)],
                            required=True)
    password = fields.String(validate=[validate.str_range(8, 16)],
                             required=True)
コード例 #10
0
class UserModifyPasswordParse(BaseMarshmallow):
    password = fields.String(validate=[validate.str_range(8, 16)],
                             required=True)
    password_ = fields.String(validate=[validate.str_range(8, 16)],
                              required=True)
    code = fields.String(validate=[validate.str_range(6, 6)], required=True)
コード例 #11
0
class UpdateUserInfoParse(BaseMarshmallow):
    nickname = fields.String(validate=[validate.str_range(0, 32)])
    description = fields.String(validate=[validate.str_range(0, 255)])
    gender = fields.Integer(validate=[validate.choice([0, 1, 2])], missing=0)
    image_id = fields.Integer(validate=[validate.image_exist])
コード例 #12
0
class SendEmailCodeParse(BaseMarshmallow):
    email = fields.Email(validate=[validate.str_range(0, 128)], required=True)
コード例 #13
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class UpdateCategoryParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(1, 128)], required=True)
    sort = fields.Integer(missing=20)
    upper_id = fields.Integer(validate=[validate.category_exist(level=1)])
コード例 #14
0
ファイル: marshmallows.py プロジェクト: Tawner/tawner_blog
class AddCategoryParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(1, 128)], required=True)
    sort = fields.Integer(missing=20)
    module = fields.String(validate=[validate.choice(array=Category.MODULE_TYPE.keys())])
    upper_id = fields.Integer(validate=[validate.category_exist(level=1)])