如何知道用户是使用社交账号登录还是使用账号登录?并在模板中获取此信息?
发布于 2018-02-15 20:13:13
您可以使用模板标记:get_social_accounts
根据文档:
{% get_social_accounts user as accounts %}
Then:
{{accounts.twitter}} -- a list of connected Twitter accounts
{{accounts.twitter.0}} -- the first Twitter account
{% if accounts %} -- if there is at least one social account如果用户没有连接社交账号:
{% if user.is_anonymous %}Not logged in.{% else %} Logged in.{% endif %}https://stackoverflow.com/questions/42883933
复制相似问题