Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #primary #key #auto #increment #python #django
ADD COMMENT
Topic
Name
1+7 =