def validate_password(self, field): if self.password_confirm.data != field.data: raise form.ValidationError(message='Password does not match the confirm password')