0
我的Django項目允許用戶使用python-social-auth的django集成以Google或Facebook個人資料登錄。從python-social-auth獲取django用戶個人資料
他們登錄後,有沒有辦法在Google或Facebook上獲取他們的個人資料鏈接?我試圖做這樣的事情:
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.core.mail import mail_admins
@receiver(post_save, sender=User)
def alert_new_user(sender, **kwargs):
instance = kwargs['instance']
social = instance.social_auth.last() # Assuming .last() gives me the one just added
if social is not None:
mail_admins('New user resistration',
'A new user registered with name {}'.format(instance.get_full_name()),
'<html><head/><body>A new user, <a href="{}">{}</a>, registered.</body></html>'.format(
???What goes here???, instance.get_full_name()
)
)