📜  主键自动递增 python django - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:36.245000             🧑  作者: Mango

代码示例1
In Django

1 : we have default field with name "id" which is auto increment.
2 : You can define a auto increment field using AutoField field as below.

EXAMPLE:
class Order(models.Model):
    auto_increment_id = models.AutoField(primary_key=True)
    #you use primary_key = True if you do not want to use default field "id" given by django to your model