Loading django/db/models/fields/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -313,7 +313,7 @@ class Field(RegisterLookupMixin): def _check_backend_specific_checks(self, **kwargs): app_label = self.model._meta.app_label for db in connections: if router.allow_migrate(db, app_label, model=self.model): if router.allow_migrate(db, app_label, model_name=self.model._meta.model_name): return connections[db].validation.check_field(self, **kwargs) return [] Loading tests/check_framework/test_multi_db.py +2 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,8 @@ class TestRouter(object): """ Routes to the 'other' database if the model name starts with 'Other'. """ def allow_migrate(self, db, app_label, model=None, **hints): return db == ('other' if model._meta.verbose_name.startswith('other') else 'default') def allow_migrate(self, db, app_label, model_name=None, **hints): return db == ('other' if model_name.startswith('other') else 'default') @override_settings(DATABASE_ROUTERS=[TestRouter()]) Loading Loading
django/db/models/fields/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -313,7 +313,7 @@ class Field(RegisterLookupMixin): def _check_backend_specific_checks(self, **kwargs): app_label = self.model._meta.app_label for db in connections: if router.allow_migrate(db, app_label, model=self.model): if router.allow_migrate(db, app_label, model_name=self.model._meta.model_name): return connections[db].validation.check_field(self, **kwargs) return [] Loading
tests/check_framework/test_multi_db.py +2 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,8 @@ class TestRouter(object): """ Routes to the 'other' database if the model name starts with 'Other'. """ def allow_migrate(self, db, app_label, model=None, **hints): return db == ('other' if model._meta.verbose_name.startswith('other') else 'default') def allow_migrate(self, db, app_label, model_name=None, **hints): return db == ('other' if model_name.startswith('other') else 'default') @override_settings(DATABASE_ROUTERS=[TestRouter()]) Loading