转自http://apps.hi.baidu.com/share/detail/21922174#content
Django Models的数据类型
AutoField |
IntegerField |
|||||||
BooleanField |
true/false |
|||||||
CharField |
maxlength,必填 |
|||||||
TextField |
||||||||
CommaSeparatedIntegerField |
maxlength,必填 |
逗号分隔 |
||||||
DateField |
|
|||||||
DateTimeField |
|
|||||||
EmailField |
||||||||
FileField |
upload_to,可选 |
object.get_myfile_url |
||||||
FilePathField |
|
|||||||
FloatField |
|
ImageField |
|
需要验证,即Python Imaging Library |
||||||
IntegerField |
||||||||
IPAddressField |
||||||||
NullBooleanField |
相当于设置了null=True的BooleanField |
|||||||
PhoneNumberField |
美国电话号码格式 |
|||||||
PositiveIntegerField |
正整数字段 |
|||||||
PositiveSmallIntegerField |
小的正整数字段,取决于数据库特性 |
|||||||
SlugField |
|
短标签,仅包含字母、数字、下划线、连字符,一般用于url |
||||||
SmallIntegerField |
小整数字段,依赖于数据库特性 |
|||||||
TimeField |
|
|||||||
URLField |
verify_exists(True),检查URL可用性 |
|||||||
USStateField |
两个字母表示的美国州名字段 |
|||||||
XMLField |
schema_path,必选 |
时间: 2024-10-10 00:04:38