I need to make a table 'Friend' with foreignkeys that store instances of the User class- two of them one for the friend and one for the user attribute. (Table is of relationships)
How to do this? OnetoOneField doesn;t work. It gives me an error in the terminal if I try to make both of them keys. So this is two Many to Many relationships from User to Friend.
If it's impossible, what is a better way to set this up? Can the User table have a One-to-Many relationship to itself?
class Friend(models.Model):
id = models.IntegerField(primary_key=True)
friend_id= models.ForeignKey(User, null=False)
user_id = models.ForeignKey(User, null=False)