我正在使用Django创建一个需要列数字(15,6)的应用程序(使用Postgresql),但我找不到这样做的方法.
解决方法:
来自Postgresql文档:
The types decimal and numeric are equivalent. Both types are part of the sql standard.
所以你可以使用Django的DecimalField
class MyModel(models.Model):
my_field = models.DecimalField(max_digits=15, decimal_places=6)
一些文档:
> http://www.postgresql.org/docs/current/interactive/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL
> https://docs.djangoproject.com/en/1.8/ref/forms/fields/#decimalfield
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。