from social_auth.backends import get_backends
from social_auth.utils import group_backend_by_type
-from social_auth.models import User
from social_auth.models import get_social_auth_for_user
accounts = dict(zip(keys, [None] * len(keys)))
user = request.user
- if isinstance(user, User) and user.is_authenticated():
+ if hasattr(user, 'is_authenticated') and user.is_authenticated():
accounts.update((assoc.provider.replace('-', '_'), assoc)
for assoc in get_social_auth_for_user(user))
# user comes from request.user usually, on /admin/ it will be an instance
# of auth.User and this code will fail if a custom User model was defined
- if isinstance(user, User) and user.is_authenticated():
+ if hasattr(user, 'is_authenticated') and user.is_authenticated():
associated = get_social_auth_for_user(user)
not_associated = list(set(available) -
set(assoc.provider for assoc in associated))