It is not yet supported. There is a ticket and possible ways to handle it, if you want. maybe you can even run custom sql
Support for multiple core columns
Relational database structures use a set of columns as the primary key for a table. When this set includes more than one column, it is known as a “composite” or “composite” primary key. (For more on terminology, see an article that discusses database keys). Currently, Django models support only one column in this set, negating the many constructs where several columns are the natural primary key of a table. Django is currently unable to work with these schemes; instead, they must enter a redundant single-column key ("surrogate" key), forcing applications to make arbitrary and unnecessary choices about which key to use for the table in any given instance. This page discusses how to support Django with these composite primary keys. There are a lot of details, but done correctly, this will provide greater flexibility and potential simplicity in data modeling.
Current status
The current state is that the problem is accepted / assigned and processed, and a partial implementation is performed at http://github.com/dcramer/django-compositepks. Implementation allows you to have composite primary keys. However, support for composite keys is not available in ForeignKey and RelatedManager. As a result, it is not possible to correlate relationships with models with a composite primary key.
Discussion:
David Cramer Starter Patch
Composition API External API API
Ticket
Note. SqlAlchemy allows this as described below and you can use SqlAlchemy to replace Django ORM
Foreign keys can also be defined at the table level using the ForeignKeyConstraint object. This object can describe one or more columns of a foreign key. A multi-column foreign key is known as a composite foreign key and almost always refers to a table with a composite primary key. Below we define an invoice table that has a composite primary key:
invoice = Table('invoice', metadata, Column('invoice_id', Integer, primary_key=True), Column('ref_num', Integer, primary_key=True), Column('description', String(60), nullable=False) )
And then the invoice_item table with a composite foreign key referencing the invoice:
invoice_item = Table('invoice_item', metadata, Column('item_id', Integer, primary_key=True), Column('item_name', String(60), nullable=False), Column('invoice_id', Integer, nullable=False), Column('ref_num', Integer, nullable=False), ForeignKeyConstraint(['invoice_id', 'ref_num'], ['invoice.invoice_id', 'invoice.ref_num']) )
Link