diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2014-05-08 10:33:59 -0700 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2014-05-08 10:34:45 -0700 |
| commit | f2bf59a5bc373eeb60136f3b3764e156efbc1ea8 (patch) | |
| tree | 0a27a7e91b2af5f9091d4b967deabec7e54e59da /django/db/backends/sqlite3 | |
| parent | bc82c0dbac33ced1a4d6953e8626236ae05af956 (diff) | |
[1.7.x] Fixed #22476: Couldn't alter attributes on M2Ms with through= set
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/schema.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py index 005d4b13c8..5b6155be47 100644 --- a/django/db/backends/sqlite3/schema.py +++ b/django/db/backends/sqlite3/schema.py @@ -148,8 +148,11 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): new_type = new_db_params['type'] if old_type is None and new_type is None and (old_field.rel.through and new_field.rel.through and old_field.rel.through._meta.auto_created and new_field.rel.through._meta.auto_created): return self._alter_many_to_many(model, old_field, new_field, strict) + elif old_type is None and new_type is None and (old_field.rel.through and new_field.rel.through and not old_field.rel.through._meta.auto_created and not new_field.rel.through._meta.auto_created): + # Both sides have through models; this is a no-op. + return elif old_type is None or new_type is None: - raise ValueError("Cannot alter field %s into %s - they are not compatible types (probably means only one is an M2M with implicit through model)" % ( + raise ValueError("Cannot alter field %s into %s - they are not compatible types (you cannot alter to or from M2M fields, or add or remove through= on M2M fields)" % ( old_field, new_field, )) |
