سؤال

I'm using django-social-auth for authentication. How do I figure out which social authentication backend was the request.user using when my social auth User model is django.contrib.auth.models.User?

The purpose is to show an icon (e.g. twitter, facebook, big G) next to user "profile" / logout link in the base template.

هل كانت مفيدة؟

المحلول

Have a look at django-social-auth's template context processors. For example, if you add the social_auth_backends processor, then

{{ social_auth.associated }}

would show a list of UserSocialAuth instances associated with current user.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top