Is this the correct way of making a primary key in django?? Answer No, That is not the correct way of making a primary key in Django, in fact you don’t have to specify a Primary key for your model, because django will automatically add a field to hold the primary key for you. In your settings.py file, you will
Tag: primary-key
How can I set two primary key fields for my models in Django?
I have a model like this: How can I have the primary key be the combination of migration and host? Answer Update Django 4.0 Django 4.0 documentation recommends using UniqueConstraint with the constraints option instead of unique_together. Use UniqueConstraint with the constraints option instead. UniqueConstraint provides more functionality than unique_together. unique_together may be deprecated in the future. Original Answer I