diff options
author | prathamesh | 2014-03-26 14:48:45 +0530 |
---|---|---|
committer | prathamesh | 2014-03-26 14:48:45 +0530 |
commit | ba50e500a1da9266f9bee5bc38b69635637f6129 (patch) | |
tree | 4836211b8109824d9f8912e80f83be1e6f857ce0 /testapp/myauthentication/router.py | |
parent | b2a95b4f99debc4d165bb0122b03b8e67f26b669 (diff) | |
download | online_test-ba50e500a1da9266f9bee5bc38b69635637f6129.tar.gz online_test-ba50e500a1da9266f9bee5bc38b69635637f6129.tar.bz2 online_test-ba50e500a1da9266f9bee5bc38b69635637f6129.zip |
User authentication using external database.
Django authentication backend overriden to authenticate user
using spoken tutorial database.
Added database router to handle the database operations.
Diffstat (limited to 'testapp/myauthentication/router.py')
-rw-r--r-- | testapp/myauthentication/router.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testapp/myauthentication/router.py b/testapp/myauthentication/router.py new file mode 100644 index 0000000..ffdf122 --- /dev/null +++ b/testapp/myauthentication/router.py @@ -0,0 +1,12 @@ +class MyDatabaseRouter(object): + """ + A router to manage database operations in the myauthentication app. + """ + def db_for_read(self, model, **hints): + """ + Point all read operations on myauthentication app to spoken + database. + """ + if model._meta.app_label == 'myauthentication': + return 'spoken' + return None |