Descriptive relationships between auth.users (think facebook friends and twitter followers, plus more)
Python Shell
Latest commit f15d0a1 Mar 16, 2014 @coleifer Merge pull request #36 from eryckson/master
bugfix for py3 on raise
Permalink
Failed to load latest commit information.
docs
relationships bugfix for py3 on raise Mar 16, 2014
.gitignore compat module Feb 3, 2013
.travis.yml compat module Feb 3, 2013
AUTHORS
LICENSE License change Apr 8, 2010
MANIFEST.in
README.rst Updates to the README to provide information on the Relationships admin. Apr 17, 2010
TODO.rst Added an {% if_relationship ... %} templatetag, a couple template Mar 30, 2010
runtests.py PEP 8 cleanup. Dec 27, 2012
setup.py PEP 8 cleanup. Dec 27, 2012

README.rst

django-relationships

Descriptive relationships between auth.users:

In [4]: john.relationships.friends()
Out[4]: [<User: Yoko>]

In [5]: john.relationships.following()
Out[5]: [<User: Paul>, <User: Yoko>]

In [6]: john.relationships.followers()
Out[6]: [<User: Yoko>]

In [7]: john.relationships.blockers()
Out[7]: [<User: Paul>]

In [8]: paul.relationships.blocking()
Out[8]: [<User: John>]

You can create as many types of relationships as you like, or just use the default ones, 'following' and 'blocking'.

From, To and Symmetrical

Relationship types define each of the following cases:

  • from - 'following', who I am following
  • to - 'followers', who is following me
  • symmetrical - 'friends', we follow eachother

Relationship types can be login_required, or private, and if you want to make a relationship type unviewable (i.e. you may not want to allow users to see who is blocking them), simply give it a unmatchable slug, like '!blockers'.

Admin Interface

Relationships hook right into the pre-existing User admin, and appear below the 'Groups' inline.

Installation

python setup.py install

OR

put the relationships folder on your python-path