I'm working on a project that needs two databases - one for the "logged out" portion and one for the logged in. I need the auth (and therefore contenttypes) app synched to both databases, which is working fine. However, the management commands for auth and contenttypes that create the default Permission and ContentType objects aren't running on the logged in database, only the default one. Do I have this right?
My database router
LOGGED_IN_APPS = ('avatar', 'guardian', 'money', 'ipn', 'schedule', 'studio')
COMMON_APPS = ('auth', 'contenttypes', 'registration')
class MyRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label in LOGGED_IN_APPS:
return 'logged_in'
return None
def db_for_read(self, model, **hints):
if model._meta.app_label in LOGGED_IN_APPS:
return 'logged_in'
return None
def allow_relation(self, obj1, obj2, **hints):
if obj1._meta.app_label in LOGGED_IN_APPS or obj2._meta.app_label in LOGGED_IN_APPS:
return True
return None
def allow_syncdb(self, db, model):
if db == 'logged_in':
return model._meta.app_label in LOGGED_IN_APPS or model._meta.app_label in COMMON_APPS
elif model._meta.app_label in LOGGED_IN_APPS:
return False
return None