Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's possible to save Friendships with one-self #1

Open
zerok opened this issue May 7, 2009 · 0 comments
Open

It's possible to save Friendships with one-self #1

zerok opened this issue May 7, 2009 · 0 comments

Comments

@zerok
Copy link

zerok commented May 7, 2009

http://code.google.com/p/django-friends/issues/detail?id=3

Currently, the Friendship model doesn't check to see if from_user is the
same as to_user when saving. This allows the creation of friendships with
oneself.

To fix it, I've added a custom save() method:

def save(self):
    if self.to_user == self.from_user:
        return
    else:
        super(Friendship, self).save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant