Alejandro Veintimilla
Alejandro Veintimilla

Reputation: 11523

Django. Python Social Auth get user backend

I haven't been able to find how to do this simple thing:

I have two different type of users in my website, type A users registered with Facebook and type B users logged in with a regular user register form. ¿How can I find out if a user belongs to group A? (Outside of the pipeline, of course). I need to import the Python Social Auth models and perform an .exists() query or something like that ... but what is the name of that model? where do I import it from?

Upvotes: 3

Views: 715

Answers (1)

Alejandro Veintimilla
Alejandro Veintimilla

Reputation: 11523

Solution:

from social.apps.django_app.default.models import UserSocialAuth

if UserSocialAuth.objects.filter(user=request.user).exists():
    ....

Upvotes: 2

Related Questions