Primary key must be unique by definition: it's a field that uniquely identifies the record.
A primary key is used to uniquely identify each record in the Model's database table.
primary_key=True denotes the field is the primary key for the model.
primary_key=True implies null=False and unique=True.
If our GitHub code review bot spots this issue in your pull request it gives this advice:
1 | + | class BlogPost(models.Model): | |
2 | + | id = models.UUIDField(primary_key=True, unique=False) |
Primary key must be unique by definition: it's a field that uniquely identifies the record.
Read more