django-social-auth
은 인증 프로세스의 특정 단계에서 사용자 지정 함수를 삽입 할 수있는 파이프 라인을 구현합니다 (이 기능은 사용하지 않았을 때 새로운 기능인 것처럼 보입니다). the docs here 및 example pipline function을 확인하십시오. 자신의 필요 O를 따라 custom_create_user
기능은 기본 create_user
를 래핑
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'
)
및 사용자 이름을 만들 :
그래서 당신은 함수를 작성할 수
from social_auth.backends.pipeline.user import create_user
def custom_create_user(request, *args, **kwargs):
user = *kwargs.get('user', None)
# Do something with username
return create_user(request, args, kwargs)
을 첫째로, 당신은 더 많은 동의를 시도해야 가능한 경우 귀하의 질문에 대한 답변 - 사람들이 당신을 도울 가능성이 더 높습니다. 이 질문에 관해서; 당신은 사용자 이름 등을 조작 할 수 있기를 원하십니까? __after__ 그들은 facebook으로 승인했지만 __before__ 그들의 사용자 이름은 DB에 저장됩니까? –
바로! 나는 대답을 받아들이는 것에 대해 깨닫지 못했습니다. 나는 분명히 더 많은 대답을 받아 들일 것이고, 나는 오직 한 가지 대답만을 받아 들여야한다고 생각한다. 고맙습니다. – freethrow
글쎄, 질문 당 하나의 답변 만 수락 할 수 있으며 실제로 맞으면 그렇게해야합니다. 그러나 문제를 파악하면 자신의 대답을 수락 할 수도 있습니다. –