I am using django 1.6.5 and django-allauth 0.18.0 , and the social login works as expected once we create the social application in the django admin panel.
So, my next step was to try to change the behavior of the module using adapters.
It looked simple in docs , but somehow I can't do django-allauth use my custom adapters.
So here is my attempt to try pdb in my adapters.
here is my folder / file structure:
.
├── manage.py
├── requirements.freeze
├── foo
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── foo_app
├── adapters.py
├── views.py
├── etc...
here is my foo / settings.py file:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'foo_app'
)
ACCOUNT_ADAPTER="foo_app.adapters.FooAppAccountAdapter"
SOCIALACCOUNT_ADAPTER="foo_app.adapters.FooAppSocialAccountAdapter"
And here is my foo_app / adapters.py file:
import pdb
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class FooAppAccountAdapter(DefaultAccountAdapter):
def save_user(self, request, user, form, commit=true):
print "FooAppAccountAdapter.save_user"
pdb.set_trace()
return super(FooAppAccountAdapter, self).save_user(
request, user, form, commit
)
class FooAppSocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
print "FooAppSocialAccountAdapter.pre_social_login"
pdb.set_trace()
return super(FooAppSocialAccountAdapter, self).pre_social_login(
request, sociallogin
)
def save_user(self, request, sociallogin, form=None):
print "FooAppSocialAccountAdapter.save_user"
pdb.set_trace()
return super(FooAppSocialAccountAdapter, self).save_user(
request, sociallogin, form
)
set_trace , , - , .
, ?