One - One Code All

Blog Content

Django 设置自增主键

Python   2017-07-02 10:14:09

Django 设置自增主键

class User(models.Model):
    ID = models.AutoField(primary_key=True) #设置AutoField,不要加default属性
    username = models.CharField(max_length=20)
    password = models.CharField(max_length=20, unique=True)



上一篇:python画图线条颜色、大小、类型:点、虚线等
下一篇:pandas写入读取h5文件

The minute you think of giving up, think of the reason why you held on so long.