Rectangle 27 0

You can create an autofield. Here is the documentation for the same

Please remember Django won't allow to have more than one AutoField in a model, In your model you already have one for your primary key (which is default). So you'll have to override model's save method and will probably fetch the last inserted record from the table and accordingly increment the counter and add the new record.

Please make that code thread safe because in case of multiple requests you might end up trying to insert same value for different new records.

python - How to make an auto increment integer field Django - Stack Ov...

python django django-models sqlite3
Rectangle 27 0

If you want to use django's default id as increment field .

In Django 1 : There will be a default field with name "id" which is auto increment . 2 : You can define any field as auto increment field using AutoField field.

python - How to make an auto increment integer field Django - Stack Ov...

python django django-models sqlite3