user909521
user909521

Reputation: 33

How do I access values from python social auth used in template

When using python social-auth I can access the values defined to start the login pipeline for each service via the templates using:

 <li>
   <a href="{% url 'social:begin' 'facebook' %}?next=/home/">Login with Facebook</a>
 </li>
 <li>
   <a href="{% url 'social:begin' 'google-oauth2' %}?next={/home/">Login with Google</a>
 </li>
 <li>
   <a href="{% url 'social:begin' 'linkedin' %}?next=/home/">Login with Linkedin</a>
 </li>

What I can't figure out is how to access these values within the rest of the code, I thought i could do something like:

twitterpath = ('social:begin' 'twitter')
return HttpResponseRedirect(twitterpath)

But that doesn't work, can anyone help?

Upvotes: 0

Views: 85

Answers (1)

cansadadeserfeliz
cansadadeserfeliz

Reputation: 3133

You can write:

from django.core.urlresolvers import reverse
twitterpath = reverse('social:begin', args=('twitter',))

Upvotes: 1

Related Questions