3

I am using python-social-auth with django 1.7. I have the following code in my settings.py

SOCIAL_AUTH_LOGIN_URL = '/accounts/login'
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/accounts/add_college'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'

However, when my url is like

accounts/login/?next=/display/Electronics/Random/

I want to be redirected to

display/Electronics/Random/

In my templates, I have the following code

<a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}" class="btn btn-social btn-facebook">

But, I am still redirected to the url specified in SOCIAL_AUTH_LOGIN_REDIRECT_URL. How do I take the value of the next variable into account?

Avinash Raj
  • 172,303
  • 28
  • 230
  • 274
Poorva Rane
  • 93
  • 2
  • 13

1 Answers1

2

Make sure you have TEMPLATE_CONTEXT_PROCESSORS in your settings.py:

from django.conf import global_settings
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
    "django.core.context_processors.request",
)
Ivan
  • 1,477
  • 3
  • 18
  • 36