Django Models的資料型別 彙總
轉載自: 厚燃塗想 http://lishiguang.iteye.com/blog/1243560
該博主也是轉別人的,不過百度hi已經不能用了。 感謝作者分享,轉自 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,必選 |
|
轉載自:厚燃塗想 http://lishiguang.iteye.com/blog/1243560