primary key auto increment python django
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