summaryrefslogtreecommitdiff
path: root/tests
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 /tests
parent83cd18633fb13924d8a50a1cd4ed21cb9552a635 (diff)
Fixed #23503 -- Fixed renaming of model with self-referential m2m field.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_operations.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 82292ac69f..bddb09f9e7 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -472,6 +472,22 @@ class OperationTests(OperationTestBase):
self.assertFKExists("test_rmwsrf_rider", ["friend_id"], ("test_rmwsrf_rider", "id"))
self.assertFKNotExists("test_rmwsrf_rider", ["friend_id"], ("test_rmwsrf_horserider", "id"))
+ def test_rename_model_with_self_referential_m2m(self):
+ app_label = "test_rename_model_with_self_referential_m2m"
+
+ project_state = self.apply_operations(app_label, ProjectState(), operations=[
+ migrations.CreateModel("ReflexivePony", fields=[
+ ("ponies", models.ManyToManyField("self")),
+ ]),
+ ])
+ project_state = self.apply_operations(app_label, project_state, operations=[
+ migrations.RenameModel("ReflexivePony", "ReflexivePony2"),
+ ])
+ apps = project_state.render()
+ Pony = apps.get_model(app_label, "ReflexivePony2")
+ pony = Pony.objects.create()
+ pony.ponies.add(pony)
+
def test_add_field(self):
"""
Tests the AddField operation.