On 3/25/07, checco <[EMAIL PROTECTED]> wrote:
>
> and I want to create a primary key that is composed of field1 and
> field 2 in table 3, is this possible in django? Can I do something
> like...
>
> field1 = ForeignKey('table1', primarykey=True)
> field2= ForeignKey('table2', primarykey=True)

Hi Francesco,

You can make any individual field the primary key using
`primary_key=True` - so, for example:

class MyModel(models.Model):
    key = ForeignKey('table1', primary_key=True)
    data = ...

would make a foreign key on Table1 the primary key on MyModel.
However, if you give multiple fields the primary_key attribute, only
the first will be used to designate a primary key. Django does not
currently support multiple field primary keys.

Yours,
Russ Magee %-)

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

Reply via email to