如何从Django模型创建双字和长文本字段 [英] How to create double and long text field from django models
问题描述
如何使用Django模型在mysql中创建 double
字段。我遇到此错误,以及如何使用django创建 longtext
数据类型
How to create a double
field in mysql using django models. i run into this error and also how to create a longtext
datatype with django
class Test(models.Model):
maxcount = models.DoubleField(null=True) ## double DEFAULT NULL,
cs = models.TextField()#longtext,
错误:
maxcount = models.DoubleField(null=True) ##double DEFAULT NULL,
AttributeError: 'module' object has no attribute 'DoubleField'
推荐答案
https://docs.djangoproject.com/zh-CN/1.8/ref/models/fields/#bigintegerfield
https://docs.djangoproject.com/zh-CN/1.8/ref/models/fields/#decimalfield < br>
https://docs.djangoproject.com/en/dev/ref/models/fields/#floatfield
在
使用 https://docs.djangoproject.com/zh-CN/1.8/ref/models/fields/#charfield 用于Char字段并设置最大和最小参数
Use big int in a case when you want an Integer and decimal field.
Use https://docs.djangoproject.com/en/1.8/ref/models/fields/#charfield for Char field and set max and min parameters
这篇关于如何从Django模型创建双字和长文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!