django-social-auth implements a pipeline (this seems to be a new function that was not there when I tried it), which allows you to insert custom functions at certain stages of the authentication process. Here you can find documents and an example pipline function .
So you can write a function:
SOCIAL_AUTH_PIPELINE = ( 'social_auth.backends.pipeline.social.social_auth_user', 'social_auth.backends.pipeline.associate.associate_by_email', 'social_auth.backends.pipeline.user.get_username', 'app.pipeline.custom_create_user', 'social_auth.backends.pipeline.social.associate_user', 'social_auth.backends.pipeline.social.load_extra_data', 'social_auth.backends.pipeline.user.update_user_details' )
where your custom_create_user function wraps custom_create_user by default and creates a username according to your own needs:
from social_auth.backends.pipeline.user import create_user def custom_create_user(request, *args, **kwargs): user = *kwargs.get('user', None)
source share