diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-09 03:35:02 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-03-09 03:35:02 +0000 |
| commit | b4dd4d4bb7db6533e13be1455ccdc52c3d50cac3 (patch) | |
| tree | 8db98c18415f071584c8f59369872f4fb6b35925 /django/db/backends/__init__.py | |
| parent | 98710a5a2853594f5bad161f9a3bedd27171bb89 (diff) | |
Fixed #3163 -- Add a "Meta.managed" option to models.
This allows a model to be defined which is not subject to database table
creation and removal. Useful for models that sit over existing tables or
database views.
Thanks to Alexander Myodov, Wolfgang Kriesing and Ryan Kelly for the bulk of
this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/__init__.py')
| -rw-r--r-- | django/db/backends/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 6b027de193..5a3cb53842 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -450,6 +450,8 @@ class BaseDatabaseIntrospection(object): tables = set() for app in models.get_apps(): for model in models.get_models(app): + if not model._meta.managed: + continue tables.add(model._meta.db_table) tables.update([f.m2m_db_table() for f in model._meta.local_many_to_many]) if only_existing: @@ -476,6 +478,8 @@ class BaseDatabaseIntrospection(object): for app in apps: for model in models.get_models(app): + if not model._meta.managed: + continue for f in model._meta.local_fields: if isinstance(f, models.AutoField): sequence_list.append({'table': model._meta.db_table, 'column': f.column}) |
