gpt4 book ai didi

python - 如何显示来自谷歌帐户的图像: django-allauth

转载 作者:行者123 更新时间:2023-12-01 04:40:22 24 4
gpt4 key购买 nike

我正在通过 facebook 和 google 在我的应用程序中使用 django-allauth 进行用户注册。我可以显示用户的 Facebook 图像。但我不知道如何为谷歌做到这一点。对于facebook,我已经遵循了这个教程http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/

有人可以建议我如何在我的网站中显示用户的 Google 帐户图像吗?

最佳答案

正如这里提到的How to populate user profile with django-allauth provider information? :

在您的服务器端代码中,您可以尝试

user.socialaccount_set.filter(provider='google')[0].extra_data['picture']

在模板中你可以这样得到它

<img src="{{ user.socialaccount_set.all.0.get_avatar_url }}" />

关于python - 如何显示来自谷歌帐户的图像: django-allauth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30810028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com