Re: More than one primary key for a model

2010-06-29 Thread ringemup
No, it doesn't use unique_together to do the joins, but unique_together will enforce the uniqueness constraint of the compound key, and allow you to do a lookup of an object based on the compound key. As Bruno explained, you'll have to use for surrogate primary keys the auto-generated integer prim

Re: More than one primary key for a model

2010-06-29 Thread bruno desthuilliers
On 28 juin, 19:27, thusjanthan wrote: > Yes you are correct I am looking to implement the compounded primary > keys. It's a fact that Django's ORM doesn't support compound primary keys so far. It's a bit of a shortcoming, but the good news is that it's a FOSS project so YOU can contribute !-) OT

Re: More than one primary key for a model

2010-06-28 Thread thusjanthan
Yes you are correct I am looking to implement the compounded primary keys. Well the problem is I would like to have a many to many(m2m) with two models that share a compounded primary key. However when I do the m2m join it randomly pics one of the compounded keys and tries to join them? :| Does the

Re: More than one primary key for a model

2010-06-28 Thread ringemup
By definition a database table can have only one primary key. I believe what you're looking to implement are compound primary keys. Depending on the database backend you're using, the unique_together Meta attribute may accomplish most of what you're looking to do. On Jun 28, 12:49 pm, thusjantha

More than one primary key for a model

2010-06-28 Thread thusjanthan
Can anyone tell me why django refuses to follow the rules and lesson we learn in our database courses? I have a table that I do not have control over. Suppose its called the phone table and it contains the number and the username as the primary key. But for some reason when I have more than one pr