Q:

Tell Django's model to use as primary key a set of foreign keys

I have Persons and Proposals.  Now I want to store the Person's votes on Proposals.  To do so, I'll create another class which will provide an "intermediary" table.  The goal is to link a Person with a Proposal and associate a vote direction (upvote or downvote).  Code below:
class Persons(models. Model):
   #code
class Proposal(models. Model):
   #code
class Vote(models. Model):
    """A Person (who) votes up or down (direction) a Proposal (what).""" 
    who = models. ForeignKey(Person)
    what = models. ForeignKey(Proposal)
    direction = models. BooleanField()   # true = upvote = vote in favor

I wanted the PrimaryKey of Vote to be (who, what) together.  Instead, Django created a table with an default AUTO-INCREMENTED id as PrimaryKey.  How can I set a ForeignKey (or a set of ForeignKeys) as PrimaryKey? 

A:

I too had a similar problem and i was able to work around it by using unique_together meta (in your case under class Vote).  read more about unique_together at
https://docs.djangoproject.com/en/dev/ref/models/options/

A:

Django ORM does not support composite primary keys: https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys

