1、报错截图,当小伙伴们遇到这种沙雕问题时是不是也是很烦躁?
2、分析Traceback ,发现有熟悉的,我重写了admin.ModelAdmin的save_related方法,分析应该是再多对多保存时出现了问题。
3、看上去好像是scripts这个字段在保存时出现了问题。然后发现这个字段在后台也做了一个表单验证。
在校验scripts这个字段时,当job_type==2时没有对应的返回,所以job_type==1每次都成功了,2都是失败的。
文档:
https://docs.djangoproject.com/zh-hans/3.2/ref/forms/validation/
- NoneType iterable django object 39nonetype iterable django object 39 attribute nonetype object typeerror nonetype python object 39 attributeerror attribute nonetype 39 attribute nonetype children 原型iterator对象object 39 importerror collections iterable 39 attribute strftime object 39 bson get_object_size site-packages get_object_or django models object