Add docstring for populate_user

This commit is contained in:
Andrew Chen Wang 2022-12-23 19:50:35 -05:00 committed by GitHub
parent 541f09ab55
commit e29bd6f2b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,10 @@ class SocialAccountAdapter(DefaultSocialAccountAdapter):
def is_open_for_signup(self, request: HttpRequest, sociallogin: Any):
return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
def populate_user(self, request, sociallogin, data):
"""
Populates user information from social provider info
See: https://django-allauth.readthedocs.io/en/latest/advanced.html?highlight=populate_user#creating-and-populating-user-instances
"""
user = sociallogin.user
if name := data.get("name"):
user.name = name