coleifer / django-relationships

Descriptive relationships between auth.users (think facebook friends and twitter followers, plus more)
http://django-relationships.readthedocs.org
MIT License
371 stars 98 forks source link

You can add a symmetrical relationship without approval #29

Closed epicserve closed 11 years ago

epicserve commented 11 years ago

I'm not sure if I'm just being dense, but it seems to me when you look at tests.py and the method test_adding_symm lines 411 - 422, that this isn't the correct behavior. According to how I'm reading this this, John can make friends with The_Walrus without The_Walrus approving the friend request. Is that correct and if so, should this be corrected? If I was The_Walrus I'm not sure I would want John to have the ability to connect as a friend without my approval.

coleifer commented 11 years ago

There is no approval mechanism as part of django-relationships -- it simply provides a way for connecting users and querying those relationships. The test is correct in that it is testing that a symmetrical relationship is automatically created.

Suppose you wanted to build a facebook site w/approvals...you would have one user "follow" another (1-way), then the pending requests would be a given user's followers (excluding those they followed in turn). When a user wanted to "approve" a request, they would simply follow in turn and the relationship would become symmetrical.

This isn't built into django-relationships because the logic for handling approvals will probably be app-specific.

epicserve commented 11 years ago

I ended up making my own views for this, in a proprietary app called "friends" in the project I'm using django-relationships on.

It sure would cut down and the learning curve and the time it takes to add friending to a project if there were two different example projects included with django-relationships one for Facebook style friends and one for Twitter style friends.

I would be happy to help work on adding the Facebook style example app, since I have a lot of that work mostly done.

coleifer commented 11 years ago

Thank you so much, I will take a look at making this happen but if you've already got a lot of the wokr out of the way I'd be happy to review and merge.

epicserve commented 11 years ago

Since my code is in it's own app that depends on django-relationships, it might be better if I just put my code in a gist or something and then have you suggest the best way to re-use the code.