django - Django Inline Formset Clean 方法不会在模板中引发验证错误?
问题描述
我正在使用内联表单集,我使用了干净的方法,但干净的方法没有引发错误,我也使用了'{{ formset.non_form_errors }}'。下面的 clean 方法截断了打印语句到达最后一刻,直到没有引发验证错误后到达。为什么 ?
if self.instance.tax not in (None, ''):
if total != self.instance.tax:
self.errors.append({"error":"The Sum of different Tax Breakups should be equal to total TAX rate"})
print("reaching last moment")
raise forms.ValidationError("The Sum of different Tax Breakups should be equal to total TAX rate")
解决方案
推荐阅读
- c - 如何为c中堆上声明的变量赋值?
- android - Android Studio 4.1 gradle 6.7:获取 manifestOutputDirectory 错误
- python-3.x - 在指定位置的整数列中添加逗号(熊猫)
- python - spyder中的内核重新启动(Ctrl +。)不起作用
- salesforce - 在 Mulesoft Api 开发中,要将任何应用程序与 Salesforce 集成,我们是否需要使用 Salesforce 连接器或 http 请求?
- javascript - API 结果说它是空的,但它不是
- node.js - 无法通过 id 找到文档
- webdriver-io - 在调用 browser.getTabIds() 时获取“browser.getTabIds”不是 webdriverio 中的函数
- python - 根据标记颜色过滤叶图
- java - 弹簧断路器 - Resilience4j - 如何配置?