📜  django 表单错误自定义 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:01.081000             🧑  作者: Mango

代码示例2
class AccountForm(forms.Form):
    ....your stuff

    def clean_password(self):
        if self.data['password'] != self.data['password_confirm']:
            raise forms.ValidationError('Passwords are not the same')
        return self.data['password']