I'm trying to override the save user method in account adapter, but the save_user method never seems to get hit.
adapter.py
class DefaultOverrideAccountAdapter(DefaultAccountAdapter):
def save_user(self, request, user, form, commit=False):
user = super(DefaultOverrideAccountAdapter, self).save_user(request, user, form, commit)
user.gender = form.cleaned_data.get('gender')
user.date_of_birth = form.cleaned_data.get('date_of_birth')
if commit:
user.save()
settings.py
ACCOUNT_ADAPTER = 'adapter.DefaultOverrideAccountAdapter'
I have the same issue. Is there any workarounds?
I know it's too late for this but hopefully will be useful for somebody. Here's my workaround:
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class CustomSocialAccountAdapter(DefaultSocialAccountAdapter):
def save_user(self, request, sociallogin, form):
user = super(CustomSocialAccountAdapter, self).save_user(request, sociallogin, form)
# Do what ever you want with the user
return user
settings.py
SOCIALACCOUNT_ADAPTER = 'path.to.CustomSocialAccountAdapter'
I don't think there is an issue in allauth here. For example, try putting a pdb into the save_user method and run the test suite. You'll clearly see it being hit.
I am not sure why overriding save_user is returning me a server error (500) in its callback URL. I am not sure why this is happening!!
Most helpful comment
I know it's too late for this but hopefully will be useful for somebody. Here's my workaround:
settings.py
SOCIALACCOUNT_ADAPTER = 'path.to.CustomSocialAccountAdapter'