2019-12-21 03:49:56 +08:00
|
|
|
class DefaultOtherRouter:
|
|
|
|
def allow_migrate(self, db, app_label, model_name=None, **hints):
|
|
|
|
return db in {"default", "other"}
|
2016-09-02 04:19:29 +08:00
|
|
|
|
|
|
|
|
2017-01-19 15:39:46 +08:00
|
|
|
class TestRouter:
|
2016-01-25 08:23:38 +08:00
|
|
|
def allow_migrate(self, db, app_label, model_name=None, **hints):
|
|
|
|
"""
|
|
|
|
The Tribble model should be the only one to appear in the 'other' db.
|
|
|
|
"""
|
|
|
|
if model_name == "tribble":
|
|
|
|
return db == "other"
|
2019-12-21 03:49:56 +08:00
|
|
|
elif db != "default":
|
2016-01-25 08:23:38 +08:00
|
|
|
return False
|