我收到以下错误:
TypeError:“int”对象不可调用
response = receiver(signal=self, sender=sender, **named) File "/Users/user/Documents/workspace/LiveWireSMS/sms/models/message.py", line 156, in my_handler instance.charge = instance.length (实例.内容)
从这段代码中:
@receiver(pre_save, sender=Message)
def my_handler(sender, **kwargs):
instance = kwargs['instance']
if not instance.charge:
instance.charge = instance.length(instance.content)
这是它的调用函数:
@property
def length(self):
return len(self.content) / 160 + 1
有人可以解释错误吗?谢谢你。