1、AutoField
一个自增的IntegerField,一般不直接使用,Django会自动给每张表添加一个自增的primary key。
2、BigIntegerField
64位整数, -9223372036854775808 到 9223372036854775807。默认的显示widget 是 TextInput.
3、BinaryField ( Django 1.6 版本新增 )
存储二进制数据。不能使用 filter 函数获得 QuerySet
4、BooleanField
True/False,默认的widget 是 CheckboxInput。
如果需要置空,则必须用 NullBooleanField 代替。
Django 1.6 修改:BooleanField 的默认值 由 False 改为 None,在 default 属性未设置的情况下。
5、CharField
存储字符串。必须有 max_length 参数指定长度。默认的form widget 是 TextInput
如果字符串巨长,推荐使用 TextField。
6、CommaSeparatedIntegerField
一串由逗号分开的整数。必须有 max_length 参数。
7、DateField
日期,与python里的datetime.date 实例同。有以下几个可选的选项,均为bool类型:
DateField.auto_now: 每次执行 save 操作的时候自动记录当前时间,常作为最近一次修改的时间 使用。注意:总是在执行save 操作的时候执行,无法覆盖。
DateField.auto_now_add: 第一次创建的时候添加当前时间。常作为 创建时间 使用。注意:每次create 都会调用。
默认的form widget 是 TextInput。
注意:设置auto_now 或者 auto_now_add 为 True 会导致当前自动拥有 editable=False 和 blank = True 设置。
8、DateTimeField
日期+时间。与python里的 datetime.datetime 实例同。常用附加选项和DateField一样。
默认 form widget 是一个 TextInput
9、DecimalField
设置了精度的十进制数字。
A fixed-precision decimal number, represented in Python by a Decimal instance. Has two req