| 617 | def test_rename_m2m_target_model(self): |
| 618 | app_label = "test_rename_m2m_target_model" |
| 619 | project_state = self.apply_operations(app_label, ProjectState(), operations=[ |
| 620 | migrations.CreateModel("Rider", fields=[]), |
| 621 | migrations.CreateModel("Pony", fields=[ |
| 622 | ("riders", models.ManyToManyField("Rider")), |
| 623 | ]), |
| 624 | ]) |
| 625 | # Pony = project_state.apps.get_model(app_label, "Pony") |
| 626 | # Rider = project_state.apps.get_model(app_label, "Rider") |
| 627 | # pony = Pony.objects.create() |
| 628 | # rider = Rider.objects.create() |
| 629 | # pony.riders.add(rider) |
| 630 | |
| 631 | project_state = self.apply_operations(app_label, project_state, operations=[ |
| 632 | migrations.RenameModel("Rider", "Rider2"), |
| 633 | ]) |
| 634 | # Pony = project_state.apps.get_model(app_label, "Pony2") |
| 635 | # Rider = project_state.apps.get_model(app_label, "Rider") |
| 636 | # pony = Pony.objects.create() |
| 637 | # rider = Rider.objects.create() |
| 638 | # pony.riders.add(rider) |
| 639 | # self.assertEqual(Pony.objects.count(), 2) |
| 640 | # self.assertEqual(Rider.objects.count(), 2) |
| 641 | # self.assertEqual(Pony._meta.get_field('riders').remote_field.through.objects.count(), 2) |
| 642 | |