summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2014-09-17 11:34:10 +0600
committerTim Graham <timograham@gmail.com>2014-09-23 10:03:37 -0400
commit463952d94014ac2ea70a96828ddbf1330b504fc7 (patch)
tree52716d2a177c77419754fe14ed3d221a46886164 /django/db
parent83cd18633fb13924d8a50a1cd4ed21cb9552a635 (diff)
Fixed #23503 -- Fixed renaming of model with self-referential m2m field.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/backends/schema.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py
index fadb34eac7..8bc16dab2d 100644
--- a/django/db/backends/schema.py
+++ b/django/db/backends/schema.py
@@ -724,6 +724,12 @@ class BaseDatabaseSchemaEditor(object):
old_field.rel.through._meta.get_field_by_name(old_field.m2m_reverse_field_name())[0],
new_field.rel.through._meta.get_field_by_name(new_field.m2m_reverse_field_name())[0],
)
+ self.alter_field(
+ new_field.rel.through,
+ # for self-referential models we need to alter field from the other end too
+ old_field.rel.through._meta.get_field_by_name(old_field.m2m_field_name())[0],
+ new_field.rel.through._meta.get_field_by_name(new_field.m2m_field_name())[0],
+ )
def _create_index_name(self, model, column_names, suffix=""):
"""