Hello,
Im reading a django book and it adds friends to user authentication
system by making:

(was .96)

class Friendship(models.Model):
  from_friend = models.ForeignKey(
    User, related_name='friend_set'
  )
  to_friend = models.ForeignKey(
    User, related_name='to_friend_set'
  )
  def __str__(self):
    return '%s, %s' % (
      self.from_friend.username,
      self.to_friend.username
    )
  class Admin:
    pass
  class Meta:
    unique_together = (('to_friend', 'from_friend'), )

But for this to work, you have to add friendship both ways. Ex/ user1 -
> user2 and user2 -> user1 which means almost duplicate entries in
this model. And anytime you modify one friendship, you have to do the
same to the other one.

Is there a better way to do this so that only one entry exists in the
db? Any suggestions are welcome!

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

Reply via email to