Reputation: 122432
I have a model in Django 1.2.4. It has two fields that I would like to act together as a key. Is this possible?
This documentation only talks about a single field being a primary key.
Upvotes: 1
Views: 438
Reputation: 3043
You may know this already, but one option would be to force the pair is unique and let Django add its own Primary Key. So suppose you want two fields to be a primary key, well, make them unique together and then make each of those fields a db index.
Upvotes: 1