You want to link to the id field in the auth_user table. Try the
following:
from django.contrib.auth.models import User
class details(models.Model):
user = models.ForeignKey(User)
On May 16, 1:38 pm, [email protected] wrote:
> Hi joshua,
>
> Yes, I just want to link username to details table.
>
> Regards,
> Lokesh
>
> On May 16, 7:30 pm, Joshua Russo <[email protected]> wrote:
>
> > Foreign keys only point to primary key values. That's just how
> > relational DBs work
>
> > It looks like you just want to link details to a user. Is that
> > correct?
>
> > On May 16, 12:46 pm, [email protected] wrote:
>
> > > Hi All,
>
> > > Is it possible to create a foreign key to a model referring to a non
> > > primary column from other model.
>
> > > class details(models.Model):
> > > username = ????????
>
> > > ?????? -> how I can refer this field as a foreign key to username
> > > column which is from auth_user table.
>
> > > Thanks in advance.
>
> > > Regards,
> > > Lokesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---