tests/migrations/routers.py
raw| 1 | class DefaultOtherRouter: |
| 2 | def allow_migrate(self, db, app_label, model_name=None, **hints): |
| 3 | return db in {"default", "other"} |
| 4 | |
| 5 | |
| 6 | class TestRouter: |
| 7 | def allow_migrate(self, db, app_label, model_name=None, **hints): |
| 8 | """ |
| 9 | The Tribble model should be the only one to appear in the 'other' db. |
| 10 | """ |
| 11 | if model_name == "tribble": |
| 12 | return db == "other" |
| 13 | elif db != "default": |
| 14 | return False |