python django model類型總結

來源:互聯網
上載者:User

標籤:

V=models.CharField(max_length=None[, **options])    #varchar
V=models.EmailField([max_length=75, **options])    #varchar
V=models.URLField([verify_exists=True, max_length=200, **options])    #varchar
V=models.FileField(upload_to=None[, max_length=100, **options])    #varchar upload_to指定儲存目錄可帶格式,
V=models.ImageField(upload_to=None[, height_field=None, width_field=None, max_length=100, **options])
V=models.IPAddressField([**options])    #varchar
V=models.FilePathField(path=None[, match=None, recursive=False, max_length=100, **options]) #varchar
V=models.SlugField([max_length=50, **options])    #varchar,標籤,內含索引
V=models.CommaSeparatedIntegerField(max_length=None[, **options])    #varchar
V=models.IntegerField([**options])    #int
V=models.PositiveIntegerField([**options])    #int 正整數
V=models.SmallIntegerField([**options])    #smallint
V=models.PositiveSmallIntegerField([**options])    #smallint 正整數
V=models.AutoField(**options)    #int;在Django代碼內是自增
V=models.DecimalField(max_digits=None, decimal_places=None[, **options])    #decimal
V=models.FloatField([**options])    #real
V=models.BooleanField(**options)    #boolean或bit
V=models.NullBooleanField([**options])    #bit欄位上可以設定上null值
V=models.DateField([auto_now=False, auto_now_add=False, **options])    #date
   #auto_now最後修改記錄的日期;auto_now_add添加記錄的日期,修改時此時間不發生變化 
V=models.DateTimeField([auto_now=False, auto_now_add=False, **options])    #datetime
V=models.TimeField([auto_now=False, auto_now_add=False, **options])    #time
V=models.TextField([**options])    #text

V=models.XMLField(schema_path=None[, **options])    #text

V=models.ForeignKey(othermodel[, **options])    #外鍵,關聯其它模型,建立關聯索引

V=models.ManyToManyField(othermodel[, **options])    #多對多,關聯其它模型,建立關聯表
V=models.OneToOneField(othermodel[, parent_link=False, **options])    #一對一,欄位關聯表屬性

python django model類型總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.