def db_for_write(self, model, **hints): db_name = None if hasattr(model, "connection_name"): if model.connection_name in choose_list: dbsource_str = ThreadLocal.get_current_dbsource() if dbsource_str: db_name = "%s_%s" % (dbsource_str, model.connection_name) return db_name
def allow_syncdb(self, db, model): if hasattr(model, "connection_name"): if model.connection_name in choose_list: dbsource_str = ThreadLocal.get_current_dbsource() if dbsource_str: db_name = "%s_%s" % (dbsource_str, model.connection_name) if db_name == db: return True return None