Django Model的字段类型

author = models.OneToOneField(Author,verbose_name='作者')

sex = models.BooleanField('性别',max_length=1,choices=((0,'男'),(1,'女'),),default=0)

email = models.EmailField('邮箱')

address = models.CharField('地址',max_length=50)

birthday = models.DateField(verbose_name='生日')

hometown = models.CharField('家乡',max_length=50)


models.CharField  字符串类型

models.BooleanField  布尔类型

models.DateField 日期类型

models.EmailField  邮件类型

models.URLField  网址类型


nid = models.AutoField(primary_key=True)

你可能感兴趣的:(Django Model的字段类型)