omab/django-social-auth — pull request #528 by barracel (2012-11-14 10:38:00+00:00)
Title: Unable to use reverse_lazy in SOCIAL_AUTH_LOGIN_REDIRECT_URL variable 

Using reverse_lazy in SOCIAL_AUTH_LOGIN_REDIRECT_URL raises an exception::

ImproperlyConfigured: The included urlconf social_auth.urls doesn't have any patterns in it

The problem is the following line in social_auth.views::

DEFAULT_REDIRECT = setting('SOCIAL_AUTH_LOGIN_REDIRECT_URL') or \
setting('LOGIN_REDIRECT_URL')

The 'or' clause forces reverse_lazy to evalute to check if the value it's True/False. As DEFAULT_REDIRECT is defined in import time the URLConf of the application is not ready yet.

To remove the use of 'or' I used the same approach as in the LOGIN_ERROR_URL variable.