]> git.parisson.com Git - django-social-auth.git/commitdiff
Use association wise disconnection in example
authorRohan Jain <crodjer@gmail.com>
Mon, 13 Jun 2011 06:52:47 +0000 (12:22 +0530)
committerRohan Jain <crodjer@gmail.com>
Mon, 13 Jun 2011 06:52:47 +0000 (12:22 +0530)
Use the updated individual dissociation, added in commit
'dce385085b3fa1a47fa2620983079e8e69480118', in the example application

example/app/views.py
example/templates/done.html

index ecc9825f515ae2c020a622b4481478e095a5b3a4..692a171eac399d942d55ed067bceacee58b0d689 100644 (file)
@@ -19,8 +19,10 @@ def home(request):
 @login_required
 def done(request):
     """Login complete view, displays user data"""
-    names = request.user.social_auth.values_list('provider', flat=True)
-    ctx = dict((name.lower().replace('-', '_'), True) for name in names)
+    names = request.user.social_auth.all()
+    ctx = {
+        'names':names,
+    }
     ctx['version'] = version
     ctx['last_login'] = request.session.get('social_auth_last_login_backend')
     return render_to_response('done.html', ctx, RequestContext(request))
index f5abc9b625610dd43c5c0839b6bbcf60ffe8e923..be9390b050d08bb4d55e9550902c37e9b9465df2 100644 (file)
 </div>
 
 <div>
+  <h3>Disconnect accounts</h3>
+    <ul>
+    {% for account in names %}
+      <li>
+          <span class="disconnect">
+              <a href={% url disconnect-individual account.provider account.id %}>{{ account.provider }} ({{ account.id }})</a>
+          </span>
+          </br>
+      </li>
+    {% endfor %}
+    </ul>
   <h3>Associate new OAuth credentials:</h3>
   <ul>
     <li>
       <a rel="nofollow" href="{% url associate_begin "twitter" %}">Twitter</a>
-      {% if twitter %}<span class="disconnect">(<a href="{% url disconnect "twitter" %}">disconnect</a>)</span>{% endif %}
     </li>
     <li>
       <a rel="nofollow" href="{% url associate_begin "facebook" %}">Facebook</a>
-      {% if facebook %}<span class="disconnect">(<a href="{% url disconnect "facebook" %}">disconnect</a>)</span>{% endif %}
     </li>
     <li>
       <a rel="nofollow" href="{% url associate_begin "linkedin" %}">LinkedIn</a>
-      {% if linkedin %}<span class="disconnect">(<a href="{% url disconnect "linkedin" %}">disconnect</a>)</span>{% endif %}
     </li>
     <li>
       <a rel="nofollow" href="{% url associate_begin "orkut" %}">Orkut</a>
-      {% if orkut %}<span class="disconnect">(<a href="{% url disconnect "orkut" %}">disconnect</a>)</span>{% endif %}
     </li>
     <li>
       <a rel="nofollow" href="{% url associate_begin "google-oauth" %}">Google OAuth</a>
-      {% if google_oauth %}<span class="disconnect">(<a href="{% url disconnect "google-oauth" %}">disconnect</a>)</span>{% endif %}
     </li>
   </ul>
 
   <ul>
     <li>
       <a rel="nofollow" href="{% url associate_begin "google-oauth2" %}">Google OAuth2</a>
-      {% if google_oauth2 %}<span class="disconnect">(<a href="{% url disconnect "google-oauth2" %}">disconnect</a>)</span>{% endif %}
     </li>
     <li>
       <a rel="nofollow" href="{% url associate_begin "foursquare" %}">Foursquare</a>
-      {% if foursquare %}<span class="disconnect">(<a href="{% url disconnect "foursquare" %}">disconnect</a>)</span>{% endif %}
     </li>
   </ul>
 
   <ul>
     <li>
       <a rel="nofollow" href="{% url associate_begin "google" %}">Google OpenID</a>
-      {% if google %}<span class="disconnect">(<a href="{% url disconnect "google" %}">disconnect</a>)</span>{% endif %}
     </li>
     <li>
       <a rel="nofollow" href="{% url associate_begin "yahoo" %}">Yahoo</a>
-      {% if yahoo %}<span class="disconnect">(<a href="{% url disconnect "yahoo" %}">disconnect</a>)</span>{% endif %}
     </li>
     <li>
       <form action="{% url associate_begin "livejournal" %}" method="post">{% csrf_token %}
         <div>
           <label for="openid_lj_user">LiveJournal user
-            {% if livejournal %}(<span class="disconnect"><a href="{% url disconnect "livejournal" %}">disconnect</a>)</span>{% endif %}
           </label>
           <input id="openid_lj_user" type="text" value="" name="openid_lj_user" />
           <input type="submit" value="Login"/>