24👍
✅
Yes. Since a primary key means a value that can uniquely identify an object. In the documentation on the primary_key
parameter, we see:
Field.primary_key
If
True
, this field is the primary key for the model.If you don’t specify
primary_key=True
for any field in your model,
Django will automatically add anAutoField
to hold the primary key,
so you don’t need to setprimary_key=True
on any of your fields
unless you want to override the default primary-key behavior. For
more, see Automatic primary key fields.
primary_key=True
impliesnull=False
andunique=True
. Only one primary key is allowed on an object.
Source:stackexchange.com