summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilkes <git@matthewwilkes.name>2015-02-16 19:42:11 +0000
committerMarkus Holtermann <info@markusholtermann.eu>2015-04-21 11:28:38 +0200
commite4b7daec11c3849f5dae46ddfad5fe9ef03c2482 (patch)
tree167280c2466864b7ade2939913f3787de948a0e8
parent1a1f16d67da7080241ad9f6b4325f22364ac57ba (diff)
Refs #24354 -- Prevented repointing of relations on superclasses when migrating a subclass's name change
The issue was hidden on 1.8+ until #24573 due to a bug inside the model reloading process. Forwardport of patch from ae87ad005f7b62f5fa5a29ef07443fa1bbb9baf0
-rw-r--r--django/db/migrations/operations/models.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index ece1527453..56cb8fe608 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -169,6 +169,10 @@ class RenameModel(Operation):
state.remove_model(app_label, self.old_name_lower)
# Repoint the FKs and M2Ms pointing to us
for related_object in all_related_objects:
+ if related_object.model is not model:
+ # The model being renamed does not participate in this relation
+ # directly. Rather, a superclass does.
+ continue
# Use the new related key for self referential related objects.
if related_object.related_model == model:
related_key = (app_label, self.new_name_lower)