forms.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:sample-platform 作者: CCExtractor 项目源码 文件源码
def unique_username(form, field):
    """
    Check if a user already exists with this name

    :param form: The form which is being passed in
    :type form: Form
    :param field: The data value for the 'name' inserted by new User
    :type field : StringField
    """
    user = User.query.filter(User.name == field.data).first()
    if user is not None:
        raise ValidationError('There is already a user with this name')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号