bennylope / django-organizations

:couple: Multi-user accounts for Django projects

Home Page:http://django-organizations.readthedocs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quick way to test if a User (not OrganisationUser) is a member of Organisation?

asencis opened this issue · comments

As the title suggests, is there a way to test if a User is a member of any Organisation?

If you're using the default models, any of the following ought to work:

Organization.objects.filter(users=user).exists()
OrganizationUser.objects.filter(user=user).exists()
user.organization_users.all().exists()  # use the reverse relation