0
사용자가 socialaccount 또는 계정으로 로그인했는지 어떻게 알 수 있습니까? 그리고 템플릿에서이 정보를 얻으시겠습니까? 문서 당으로 get_social_accounts
Django allauth - 사용자가 socialaccount 또는 계정으로 로그인했는지 확인하는 방법?
:
{% 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
을 그리고 사용자가 소셜 계정으로 연결되지 않은 경우 :
나는이 솔루션을 발견, 나는 최선의 해결책은 모르겠지만 그것의 작품, socialaccount에서 context_processors를 만들고이 쿼리를 수행하십시오 : 'if SocialAccount. objects.filter (user_id = request.user) .exists() : ...' – Hugo