Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何筹集Django资金_Python_Django - Fatal编程技术网

Python 如何筹集Django资金

Python 如何筹集Django资金,python,django,Python,Django,我如何筹集django的资金?我在文件里找不到。提前谢谢 xxx = Money(amount=99.21, currency='SGD') xxx= round(xxx) 错误消息 type Money doesn't define __round__ method 解决方案: 只需要重新分配金额。如果有更好的方法,请告诉我。谢谢 xxx.amount = Decimal(round(xxx.amount)) 怎么样轮(xxx.amount)?我需要实例在money实例中:(可以删除De

我如何筹集django的资金?我在文件里找不到。提前谢谢

xxx = Money(amount=99.21, currency='SGD')
xxx= round(xxx)
错误消息

type Money doesn't define __round__ method

解决方案:

只需要重新分配金额。如果有更好的方法,请告诉我。谢谢

xxx.amount = Decimal(round(xxx.amount))

怎么样
轮(xxx.amount)
?我需要实例在money实例中:(可以删除
Decimal
cast。使用
xxx.amount=round(xxx.amount,2)
使用
round
only@Leistungsabfall注释应该足够好了。我认为应该坚持这个答案。@AnupYadav Decimal typeast是必需的,否则,它将导致一个错误,例如
对象没有属性“quantize”