Im cố gắng để lưu các kết quả hoạt động trong admin.py của tôi và tôi có lỗi này:kết quả quantize có quá nhiều chữ số cho bối cảnh hiện nay
quantize result has too many digits for current context
....
def save_model(self, request, obj, form, change):
usuario_libra = obj.consignee.membresia.libra
valores = Valores.objects.get(pk=1)
vtasa = valores.tasa
vaduana = valores.aduana
vgestion = valores.gestion
vfee = valores.fee
vcombustible = valores.combustible
trans_aereo = obj.peso * usuario_libra * vtasa
aduana = (obj.peso * vaduana)*vtasa
fee_airpot = (obj.peso * vfee)*vtasa
combustible = (obj.peso * vcombustible)*vtasa
itbis = (trans_aereo+vgestion)*Decimal(0.16)
total = trans_aereo + vgestion + aduana + fee_airpot + combustible + itbis
if not obj.id:
obj.total = total
...
gì này có nghĩa là ?, mọi lĩnh vực mô hình của tôi là Decimal Bất kỳ sự giúp đỡ xin vui lòng
Cảm ơn bạn
Trợ giúp [this] (http://stackoverflow.com/questions/2051575/django-combine-models-decimalfield-with-forms-error-quantize-result-has-too) có giúp ích không? – okm
@okm tôi đã cố gắng và không trợ giúp: ( – Asinox