01 |
V = models.CharField(max_length = None [, * * options]) #varchar |
02 |
V = models.EmailField([max_length = 75 , * * options]) #varchar |
03 |
V = models.URLField([verify_exists = True ,
max_length = 200 , * * options]) #varchar |
04 |
V = models.FileField(upload_to = None [,
max_length = 100 , * * options]) #varchar |
05 |
#upload_to指定保存目錄可帶格式, |
06 |
V = models.ImageField(upload_to = None [,
height_field = None ,
width_field = None ,
max_length = 100 , * * options]) |
07 |
V = models.IPAddressField([ * * options]) #varchar |
08 |
V = models.FilePathField(path = None [,
match = None ,
recursive = False ,
max_length = 100 , * * options]) #varchar |
09 |
V = models.SlugField([max_length = 50 , * * options]) #varchar,標籤,內含索引 |
10 |
V = models.CommaSeparatedIntegerField(max_length = None [, * * options]) #varchar |
11 |
V = models.IntegerField([ * * options]) #int |
12 |
V = models.PositiveIntegerField([ * * options]) #int
正整數 |
13 |
V = models.SmallIntegerField([ * * options]) #smallint |
14 |
V = models.PositiveSmallIntegerField([ * * options]) #smallint
正整數 |
15 |
V = models.AutoField( * * options) #int;在Django代碼內是自增 |
16 |
V = models.DecimalField(max_digits = None ,
decimal_places = None [, * * options]) #decimal |
17 |
V = models.FloatField([ * * options]) #real |
18 |
V = models.BooleanField( * * options) #boolean或bit |
19 |
V = models.NullBooleanField([ * * options]) #bit字段上可以設置上null值 |
20 |
V = models.DateField([auto_now = False ,
auto_now_add = False , * * options]) #date |
21 |
#auto_now最後修改記錄的日期;auto_now_add添加記錄的日期 |
22 |
V = models.DateTimeField([auto_now = False ,
auto_now_add = False , * * options]) #datetime |
23 |
V = models.TimeField([auto_now = False ,
auto_now_add = False , * * options]) #time |
24 |
V = models.TextField([ * * options]) #text |
25 |
V = models.XMLField(schema_path = None [, * * options]) #text |
26 |
——————————————————————————– |
27 |
V = models.ForeignKey(othermodel[, * * options]) #外鍵,關聯其它模型,創建關聯索引 |
28 |
V = models.ManyToManyField(othermodel[, * * options]) #多對多,關聯其它模型,創建關聯表 |
29 |
V = models.OneToOneField(othermodel[,
parent_link = False , * * options]) #一對一,字段關聯表屬性 |