Re: Return FK model

2009-09-03 Thread Ben Davis
@Javier, not sure.. I've used user profiles on my past sites because that's what I was told to do a while ago, if inheritance works with authentication and the admin, I would definitely go that route. Also, @Yanik, I realized my UserProfile model example above was wrong, the user relation

Re: Return FK model

2009-09-03 Thread Javier Guerra
On Thu, Sep 3, 2009 at 10:41 AM, Ben Davis wrote: > The django docs suggest using a UserProfile model when you need to add more > information about a user: > http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users slightly OT: is there

Re: Return FK model

2009-09-03 Thread Ben Davis
True, you wouldn't be able to modify the auth.User model. Though you're wrong about what would happen if you were able to. What I'm saying is with a ManyToMany field, the relationship is with itself (User), so it would return User objects. The django docs suggest using a UserProfile model

Re: Return FK model

2009-09-03 Thread Yanik
Well, I can't add very well add fields to the Auth.User. But even if I could, user.friends would get me instances of "Friend" model, not "User" model. On Sep 3, 11:13 am, Ben Davis wrote: > It looks you're setting a many-to-many reflexive (circular) relationship > between

Re: Return FK model

2009-09-03 Thread Ben Davis
It looks you're setting a many-to-many reflexive (circular) relationship between users. It seems it would be better to add a ManyToManyField on the User model, eg: class User(models.Model): ... friends = ManyToManyField(User) Then you could just use "user.friends" On Thu, Sep 3,

Return FK model

2009-09-03 Thread Yanik
Let's say I have a model "Friends" that looks something like: class Friend(models.Model): user = models.ForeignKey(User) friend = models.ForeignKey(User, related_name="friend") I want a list of "User" instances of a user's friends. Is my only option to: 1) Get list of "Friends"