Django插入:这个错误是什么意思

时间:2018-04-11 12:48:59

标签: django save

请告诉我,这个错误意味着什么:

  

int()参数必须是字符串,类字节对象或数字,而不是'DeferredAttribute'

跟踪说:

  

异常类型:/ false中的TypeError异常值:int()参数   必须是字符串,字节对象或数字,而不是   'DeferredAttribute'

我猜这个错误是一个保存错误: 这是我的观点:

tier

从我看到的while(...){ ... ps.addBatch(); if ((i + 1) % 3 == 0) { // 3 is just the example, this can be much higher ps.executeBatch(); } } //Send the rest if the loop ended with `(i + 1) % 3 != 0` ps.executeBatch(); 变量是问题所在。但不知道究竟是什么问题。

1 个答案:

答案 0 :(得分:0)

我意识到问题是什么。 id_fac可以是null facture对象,如果if条件不存在,则不会在id_facture字段中插入。