diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2013-07-30 12:08:59 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2013-07-30 12:08:59 +0100 |
| commit | 12e9804d163777af17cc2a3dfdfff49e5f750ebd (patch) | |
| tree | de245c81bba1b8cb8e4cc28b8abd60f8ade5b61e /django/db | |
| parent | 68e0a169c4f9fa7f8071e014b274fd59e970f9a3 (diff) | |
Rename allow_syncdb to allow_migrate
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/backends/__init__.py | 6 | ||||
| -rw-r--r-- | django/db/utils.py | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 80e66b3ad4..7185644cc3 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -1243,7 +1243,7 @@ class BaseDatabaseIntrospection(object): for model in models.get_models(app): if not model._meta.managed: continue - if not router.allow_syncdb(self.connection.alias, model): + if not router.allow_migrate(self.connection.alias, model): continue tables.add(model._meta.db_table) tables.update([f.m2m_db_table() for f in model._meta.local_many_to_many]) @@ -1263,7 +1263,7 @@ class BaseDatabaseIntrospection(object): all_models = [] for app in models.get_apps(): for model in models.get_models(app): - if router.allow_syncdb(self.connection.alias, model): + if router.allow_migrate(self.connection.alias, model): all_models.append(model) tables = list(map(self.table_name_converter, tables)) return set([ @@ -1284,7 +1284,7 @@ class BaseDatabaseIntrospection(object): continue if model._meta.swapped: continue - if not router.allow_syncdb(self.connection.alias, model): + if not router.allow_migrate(self.connection.alias, model): continue for f in model._meta.local_fields: if isinstance(f, models.AutoField): diff --git a/django/db/utils.py b/django/db/utils.py index 36b89d9acf..c1bce7326b 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -262,10 +262,13 @@ class ConnectionRouter(object): return allow return obj1._state.db == obj2._state.db - def allow_syncdb(self, db, model): + def allow_migrate(self, db, model): for router in self.routers: try: - method = router.allow_syncdb + try: + method = router.allow_migrate + except AttributeError: + method = router.allow_syncdb except AttributeError: # If the router doesn't have a method, skip to the next one. pass |
