From ba50e500a1da9266f9bee5bc38b69635637f6129 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Wed, 26 Mar 2014 14:48:45 +0530 Subject: User authentication using external database. Django authentication backend overriden to authenticate user using spoken tutorial database. Added database router to handle the database operations. --- testapp/myauthentication/router.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 testapp/myauthentication/router.py (limited to 'testapp/myauthentication/router.py') 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 -- cgit