数值型
类型 | 用法 | 作用 | 参数 |
---|---|---|---|
AutoField | 自增字段 | 若不显示指定主键,django每次会新建一个自增字段并设置为主键 | |
BigAutoField | 类似AutoField | 存储数字为只能为 1到9223372036854775807 | |
BigIntegerField | 类似IntegerField | -9223372036854775808 到 9223372036854775807 | |
BinaryField | 二进制字段 | ||
BooleanField | 布尔型 | 存True 或 False | |
DecimalField | 浮点数字段 | 例:定义长度为8位、精度为2位的数字,例如:666666.66 cash=models.DecimalField(max_length, decimal_places=2, default=0, verbose_name=“金额”) |
|
IntergerField | 整形 | -2147483648 到 2147483647 | |
PositiveIntegerField | 无符号整型 | ||
SmallIntegerField | 短整型 | ||
Ge |