title: django one session per user
body: <p>based on docs ( <a href="http://docs.djangoproject.com/en/1.1/topics/http/sessions/" rel="nofollow">http://docs.djangoproject.com/en/1.1/topics/http/sessions/</a> ) (yes - 1.1) Django creates unique sessions to all users. Logged user contains <code>_auth_user_id</code>. How can i achieve such check in login:</p>
  
  <pre><code>If new_login._auth_user_id in database:
     delete(sessions_containing_same_id_except_new_one)
  </code></pre>
  
  <p>The main idea is to allow only one session per user and delete old 
  sessions.</p>
  
  <p><strong>UPDATE:</strong> The idea right now is to save sessionid while logging and if sessionid changes delete old entry before replacing. ATM missing part is to get that session id. </p>
  
  <p><strong>UPDATE:</strong> I got the sessionid with <code>request.session.session_key</code>. The problem was that sessionid is created <em>after</em> login. If you request key before it was created - it creates new one instead of giving any warning.</p>