Non-unique primary_key

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:

django-doctorbotsuggested changes just now
models.py
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
Update models.py

Instantly check if you have this issue for free

    Works with tools you use

    Read about how it works.