diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py index c5c824bd..874ad61d 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/adapters.py @@ -27,11 +27,12 @@ class SocialAccountAdapter(DefaultSocialAccountAdapter): See: https://django-allauth.readthedocs.io/en/latest/advanced.html?#creating-and-populating-user-instances """ - user = sociallogin.user - if name := data.get("name"): - user.name = name - elif first_name := data.get("first_name"): - user.name = first_name - if last_name := data.get("last_name"): - user.name += f" {last_name}" - return super().populate_user(request, sociallogin, data) + user = super().populate_user(request, sociallogin, data) + if not user.name: + if name := data.get("name"): + user.name = name + elif first_name := data.get("first_name"): + user.name = first_name + if last_name := data.get("last_name"): + user.name += f" {last_name}" + return user