forms.py 文件源码

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

项目:sample-platform 作者: CCExtractor 项目源码 文件源码
def validate_current_password(form, field):
        """
        Validates current password entered with the password stored in
        database

        :param form: The form which is being passed in
        :type form: AccountForm
        :param field: The data value for the 'password' entered by User
        :type field : PasswordField
        """
        if form.user is not None:
            if not form.user.is_password_valid(field.data):
                raise ValidationError('Invalid password')
        else:
            raise ValidationError('User instance not passed to form '
                                  'validation')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号