0
ユーザーがsocialaccountまたはアカウントにログインしているかどうかを確認するにはどうすればよいですか? テンプレート内にこの情報がありますか?ドキュメントを1として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