如何在不像Postgres那样显式提及小数位数和max_digits的情况下使用DecimalFields

时间:2018-08-29 05:52:47

标签: python django postgresql

我计划在Postgres中使用下表

create table Transaction (
    tax_amount decimal
);

我希望不明确指定位数。

对于Django模型,我使用

tax_amount = models.DecimalField(blank=True, null=True)

我遇到错误

billing.Transaction.tax_amount: (fields.E130) DecimalFields must define a 'decimal_places' attribute.
billing.Transaction.tax_amount: (fields.E132) DecimalFields must define a 'max_digits' attribute.

我想知道,如何将Django转换为等效的Postgres SQL,而无需明确提及decimal_placesmax_digits

0 个答案:

没有答案