Compound/Composite primary/unique key with Django

Viet picture Viet · Feb 16, 2010 · Viewed 20k times · Source

How can you create models (and thus tables) with a compound (composite) primary/unique key using Django?

Answer

Ignacio Vazquez-Abrams picture Ignacio Vazquez-Abrams · Feb 16, 2010

Django does not support compound primary keys. You can create a single compound unique key with Meta.unique_together.