저는 현재 사용자를 내 장고 앱에 로그인하고 첫 번째 사용자 생성시 튜토리얼을 보여주기 위해 python 소셜 인증을 사용하고 있습니다. 지금까지 시도했지만 pre_save 신호에서 요청이 작동하지 않습니다. 이것을 할 또 다른 방법이 있습니까?처음 로그인시 튜토리얼 만들기
@receiver(pre_save, sender=User)
def show_tutorial(sender, instance=None, **kwargs):
# For first time creation of user display tutorial
if instance._state.adding:
print ('USER CREATED')
request.session['first_login'] = True
EDIT : 내보기에는 다음 코드를 시도했지만 로그인하면 print 문이 터미널에 기록되지 않습니다.
def after_user_created(request, user, **kwargs):
user, created = User.objects.get_or_create(user=user)
if created:
request.session['first_login'] = True
print('FIRST LOGIN')
위의 편집 내용을 확인합니다. 나는 이것을 시험해 보았지만 어떤 이유로 터미널에서 print 문이 나타나지 않았기 때문에 요청이 진행되지 않았다. – Viji123
@ Viji123이 라이브러리는 사용중인 라이브러리입니까? https://github.com/python-social-auth/social-core –
아니요, https://github.com/python-social-auth/social-app-django – Viji123