name
=
models.CharField(max_length
=
30
,unique
=
True
,verbose_name
=
'姓 名'
)
birthday
=
models.DateField(blank
=
True
,null
=
True
)
GENDER_CHOICES
=
(
(
1
,
'Male'
),
(
2
,
'Female'
),
)
gender
=
models.IntegerField(choices
=
GENDER_CHOICES)
sex = models.CharField(verbose_name='性别',max_length=5,choices=(('male','男'),('female','女')),default='male')
account
=
models.IntegerField(default
=
0
)
models.DecimalField(..., max_digits=5, decimal_places=2)
EmailField(max_length=254, **options) 邮件字段,使用EmailValidator进行验证
FileField(upload_to=None, max_length=100, **options) 文件上传字段。
# file will be saved to MEDIA_ROOT/uploads/2015/01/30
upload = models.FileField(upload_to='uploads/%Y/%m/%d/')
TextField() 与CharField类似,但一般用来存储体积较大的文本。
TimeField(auto_now=False, auto_now_add=False, **options) 时间字段,其值为datetime.time实例
URLField(max_length=200, **options) URL字段
类似于CharField的子类,默认最大长度为200.
UUIDField(**options) 通用唯一标识字段,当不想用django默认设置的AutoField字段时,可以用该字段代替。