Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Generic relations should not try to drop their related table in "sqlr…

…eset".

Fixed #3480.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6921 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6754be48ec942c3c287f4cca9e6809c999a7dfeb 1 parent 4c59ca6
Malcolm Tredinnick authored December 17, 2007

Showing 1 changed file with 3 additions and 0 deletions. Show diff stats Hide diff stats

  1. 3  django/core/management/sql.py
3  django/core/management/sql.py
@@ -116,6 +116,7 @@ def sql_delete(app, style):
116 116
     "Returns a list of the DROP TABLE SQL statements for the given app."
117 117
     from django.db import connection, models, get_introspection_module
118 118
     from django.db.backends.util import truncate_name
  119
+    from django.contrib.contenttypes import generic
119 120
     introspection = get_introspection_module()
120 121
 
121 122
     # This should work even if a connection isn't available
@@ -179,6 +180,8 @@ def sql_delete(app, style):
179 180
     for model in app_models:
180 181
         opts = model._meta
181 182
         for f in opts.many_to_many:
  183
+            if isinstance(f.rel, generic.GenericRel):
  184
+                continue
182 185
             if cursor and table_name_converter(f.m2m_db_table()) in table_names:
183 186
                 output.append("%s %s;" % (style.SQL_KEYWORD('DROP TABLE'),
184 187
                     style.SQL_TABLE(qn(f.m2m_db_table()))))

0 notes on commit 6754be4

Please sign in to comment.
Something went wrong with that request. Please try again.