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 unique_together parameter fix that problem? as
in does it use the unique_together to do the joins?



On Jun 28, 10:20 am, ringemup <ringe...@gmail.com> wrote:
> 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, thusjanthan <thusjant...@gmail.com> wrote:
>
>
>
> > 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 primary key in
> > django it complains. Especially when I run the test suite it just
> > craps out saying more than one primary key detected for a model. Does
> > django really expect all tables to only contain one primary key? How
> > can I override this feature and have it take more than one primary key
> > without using things suggested by django about the unique attr in the
> > meta info of the model.
>
> > Thanks.
> > Nathan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to