{"action":"created","issue":{"url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router/issues/5","repository_url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router","labels_url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router/issues/5/comments","events_url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router/issues/5/events","html_url":"https://github.com/ambitioninc/django-dynamic-db-router/pull/5","id":160224121,"number":5,"title":"Add feature for nested usage of the context manager","user":{"login":"Svan70","id":15873484,"avatar_url":"https://avatars.githubusercontent.com/u/15873484?v=3","gravatar_id":"","url":"https://api.github.com/users/Svan70","html_url":"https://github.com/Svan70","followers_url":"https://api.github.com/users/Svan70/followers","following_url":"https://api.github.com/users/Svan70/following{/other_user}","gists_url":"https://api.github.com/users/Svan70/gists{/gist_id}","starred_url":"https://api.github.com/users/Svan70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Svan70/subscriptions","organizations_url":"https://api.github.com/users/Svan70/orgs","repos_url":"https://api.github.com/users/Svan70/repos","events_url":"https://api.github.com/users/Svan70/events{/privacy}","received_events_url":"https://api.github.com/users/Svan70/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-14T16:19:53Z","updated_at":"2016-12-02T21:13:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router/pulls/5","html_url":"https://github.com/ambitioninc/django-dynamic-db-router/pull/5","diff_url":"https://github.com/ambitioninc/django-dynamic-db-router/pull/5.diff","patch_url":"https://github.com/ambitioninc/django-dynamic-db-router/pull/5.patch"},"body":"Hi, \n\nWhen using your code I saw a behavior which was (for me) unexpected. I give an example on the following code (we suppose there are 3 databases, 'default', 'DataBase1' and 'DataBase2').\n\n``` python\nwith in_database('DataBase1', write=True):\n     # Do some stuff \n     with in_database('DataBase2', write=True): \n          # Do some stuff\n```\n\nWhen leaving the second context manager, the now routed database becomes the 'default' and not the 'DataBase1'. I just modified a few lines of code to ensure that the in_database object keeps track of the current routed db (current = when entering into the context manager) when routing to a new one. It allows in_database to route to this previous database when leaving the context manager. \nIf this feature seems appropriate to you, would you like to integrate it on the source project so that my colleagues can directly download it ? \n\nI take this opportunity to thank you for your module, I find it elegant and useful. \n\nSven \n"},"comment":{"url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router/issues/comments/264564125","html_url":"https://github.com/ambitioninc/django-dynamic-db-router/pull/5#issuecomment-264564125","issue_url":"https://api.github.com/repos/ambitioninc/django-dynamic-db-router/issues/5","id":264564125,"user":{"login":"jaredlewis","id":1641254,"avatar_url":"https://avatars.githubusercontent.com/u/1641254?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredlewis","html_url":"https://github.com/jaredlewis","followers_url":"https://api.github.com/users/jaredlewis/followers","following_url":"https://api.github.com/users/jaredlewis/following{/other_user}","gists_url":"https://api.github.com/users/jaredlewis/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredlewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredlewis/subscriptions","organizations_url":"https://api.github.com/users/jaredlewis/orgs","repos_url":"https://api.github.com/users/jaredlewis/repos","events_url":"https://api.github.com/users/jaredlewis/events{/privacy}","received_events_url":"https://api.github.com/users/jaredlewis/received_events","type":"User","site_admin":false},"created_at":"2016-12-02T21:13:46Z","updated_at":"2016-12-02T21:13:46Z","body":"Added in https://github.com/ambitioninc/django-dynamic-db-router/pull/4"}}
{"actor":{"display_login":"jaredlewis"}}