[Answered ]-Generate Django "unique_together" key with "id" field

2👍

I do not think you can have a primary key based on multiple column (cf. django doc : https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys).

Only unique_together will still work.

In case what you want is an auto incremented field which is not a primary key :

AutoField¶

class AutoField(**options)¶ An IntegerField that automatically
increments according to available IDs. You usually won’t need to use
this directly; a primary key field will automatically be added to your
model if you don’t specify otherwise. See Automatic primary key
fields.

Leave a comment