summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3
diff options
context:
space:
mode:
authorAndriy Sokolovskiy <sokandpal@yandex.ru>2015-01-09 00:51:00 +0200
committerMarkus Holtermann <info@markusholtermann.eu>2015-01-22 18:41:19 +0100
commit38c17871bb6dafd489367f6fe8bc56199223adb8 (patch)
treefbd65ffaa46f30d49b3e29ea0999090647ef6921 /django/db/backends/sqlite3
parentd450af8a2687ca2e90a8790eb567f9a25ebce85b (diff)
Fixed #24104 -- Fixed check to look on field.many_to_many instead of class instance
Diffstat (limited to 'django/db/backends/sqlite3')
-rw-r--r--django/db/backends/sqlite3/schema.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py
index 814b94ffee..031bf77840 100644
--- a/django/db/backends/sqlite3/schema.py
+++ b/django/db/backends/sqlite3/schema.py
@@ -4,7 +4,6 @@ from decimal import Decimal
from django.apps.registry import Apps
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
-from django.db.models.fields.related import ManyToManyField
from django.utils import six
import _sqlite3
@@ -71,7 +70,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
for field in create_fields:
body[field.name] = field
# Choose a default and insert it into the copy map
- if not isinstance(field, ManyToManyField):
+ if not field.many_to_many:
mapping[field.column] = self.quote_value(
self.effective_default(field)
)
@@ -94,7 +93,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
del body[field.name]
del mapping[field.column]
# Remove any implicit M2M tables
- if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
+ if field.many_to_many and field.rel.through._meta.auto_created:
return self.delete_model(field.rel.through)
# Work inside a new app registry
apps = Apps()
@@ -173,7 +172,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
table instead (for M2M fields)
"""
# Special-case implicit M2M tables
- if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
+ if field.many_to_many and field.rel.through._meta.auto_created:
return self.create_model(field.rel.through)
self._remake_table(model, create_fields=[field])
@@ -183,7 +182,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
but for M2Ms may involve deleting a table.
"""
# M2M fields are a special case
- if isinstance(field, ManyToManyField):
+ if field.many_to_many:
# For implicit M2M tables, delete the auto-created table
if field.rel.through._meta.auto_created:
self.delete_model(field.rel.through)