On Thu, 2006-09-28 at 17:08 +0000, gkelly wrote:
> Can a ForeignKey be a primary key?

Possibly not.

>  I'm getting the following error.
> 
> Here is the relevant part of the model:
> 
> class UserProfile(models.Model):
>     user = models.ForeignKey(User, primary_key=True,
> edit_inline=models.STACKED, num_in_admin=1,min_num_in_admin=1,
> max_num_in_admin=1,num_extra_on_change=0)
>     ...

Given the way you are wanting to use this, isn't there only going to be
one UserProfile per User? If that is the case, a one-to-one field will
fit your requirements nicely, since it is a primary key by default (at
the moment, you can't make it *not* be a primary key).

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to