diff options
author | Justin Bronn <jbronn@gmail.com> | 2008-08-05 17:15:33 +0000 |
---|---|---|
committer | Justin Bronn <jbronn@gmail.com> | 2008-08-05 17:15:33 +0000 |
commit | aa239e3e5405933af6a29dac3cf587b59a099927 (patch) | |
tree | ea2cbd139c9a8cf84c09e0b2008bff70e05927ef /django/core/management/sql.py | |
parent | 45b73c9a4685809236f84046cc7ffd32a50db958 (diff) | |
download | django-attic/gis.tar.gz |
gis: Merged revisions 7981-8001,8003-8011,8013-8033,8035-8036,8038-8039,8041-8063,8065-8076,8078-8139,8141-8154,8156-8214 via svnmerge from trunk.archive/attic/gisattic/gis
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@8215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/management/sql.py')
-rw-r--r-- | django/core/management/sql.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/django/core/management/sql.py b/django/core/management/sql.py index 0b01edcfc9..7c17807130 100644 --- a/django/core/management/sql.py +++ b/django/core/management/sql.py @@ -181,7 +181,7 @@ def sql_delete(app, style): for model in app_models: opts = model._meta for f in opts.local_many_to_many: - if isinstance(f.rel, generic.GenericRel): + if not f.creates_table: continue if cursor and table_name_converter(f.m2m_db_table()) in table_names: output.append("%s %s;" % (style.SQL_KEYWORD('DROP TABLE'), @@ -353,7 +353,7 @@ def many_to_many_sql_for_model(model, style): qn = connection.ops.quote_name inline_references = connection.features.inline_fk_references for f in opts.local_many_to_many: - if not isinstance(f.rel, generic.GenericRel): + if f.creates_table: tablespace = f.db_tablespace or opts.db_tablespace if tablespace and connection.features.supports_tablespaces: tablespace_sql = ' ' + connection.ops.tablespace_sql(tablespace, inline=True) @@ -435,12 +435,12 @@ def custom_sql_for_model(model, style): output = [] # Post-creation SQL should come before any initial SQL data is loaded. - # However, this should not be done for fields that are part of a - # a parent model (via model inheritance). + # However, this should not be done for fields that are part of a a parent + # model (via model inheritance). nm = opts.init_name_map() - post_sql_fields = [f for f in opts.fields if nm[f.name][1] is None and hasattr(f, '_post_create_sql')] + post_sql_fields = [f for f in opts.local_fields if hasattr(f, 'post_create_sql')] for f in post_sql_fields: - output.extend(f._post_create_sql(style, model._meta.db_table)) + output.extend(f.post_create_sql(style, model._meta.db_table)) # Some backends can't execute more than one SQL statement at a time, # so split into separate statements. |