title: Django database router
body: <p>I'd like to route (change) the database based on the authenticated user. I've looked at the <a href="https://docs.djangoproject.com/en/1.3/topics/db/multi-db/" rel="nofollow noreferrer">docs</a> but I don't know how to do this upon user login...</p>
  
  <p>I was thinking of adding a field with <code>database_name</code> to my custom <code>UserProfile</code> and then I'd like to pass this info to the database router which would make the switch...</p>
  
  <p>I don't have any code to show because I simply don't know how to implement this.</p>
  
  <p>This post somehow relates to my previous <a href="https://stackoverflow.com/questions/8740311/django-multi-user-saas">post</a>.</p>
  
  <p>So the schema would be like:</p>
  
  <pre><code>- Users (containing only the `UserProfile`)
   - user1 (containing the app database)
   - user2 (containing the app database)
   - ...
  </code></pre>
  
  <p>Could you point me to the right direction?</p>
  
  <p>Thank you!
  BR</p>