原因在于,自己利用__str__方法时,返回的不是一个字符串而已。
def __str__(self):
return self.id
以上是会报错的,改变方式如下:
return str(self.id)
希望对大家有点作用!