summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStratos Moros <stratos@indev.gr>2014-11-18 14:25:03 +0200
committerTim Graham <timograham@gmail.com>2014-11-19 09:51:07 -0500
commit50434aebe2d3307263ca55f6dd9fa7ace2f87d8f (patch)
treefcff9a51936cedf14ccc7f5ef92b305beae27770
parentdfcac7d7f5f1f108ae2c561f0f755f08d75a1c27 (diff)
[1.7.x] Fixed #22248 -- Made RenameModel reversible
Backport of cf7a2a000e from master
-rw-r--r--django/db/migrations/operations/models.py2
-rw-r--r--docs/releases/1.7.2.txt3
-rw-r--r--tests/migrations/test_operations.py3
3 files changed, 4 insertions, 4 deletions
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 5b052b4734..e195d9d841 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -106,8 +106,6 @@ class RenameModel(Operation):
Renames a model.
"""
- reversible = False
-
def __init__(self, old_name, new_name):
self.old_name = old_name
self.new_name = new_name
diff --git a/docs/releases/1.7.2.txt b/docs/releases/1.7.2.txt
index 0fe97a3225..4955f30946 100644
--- a/docs/releases/1.7.2.txt
+++ b/docs/releases/1.7.2.txt
@@ -65,3 +65,6 @@ Bugfixes
* Fixed :djadmin:`squashmigrations` to respect the ``--no-optimize`` parameter
(:ticket:`23799`).
+
+* Made :class:`~django.db.migrations.operations.RenameModel` reversible
+ (:ticket:`22248`)
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 4fb93d22de..e44c3a7931 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -433,8 +433,7 @@ class OperationTests(OperationTestBase):
self.assertFKNotExists("test_rnmo_rider", ["pony_id"], ("test_rnmo_pony", "id"))
self.assertFKExists("test_rnmo_rider", ["pony_id"], ("test_rnmo_horse", "id"))
# And test reversal
- with connection.schema_editor() as editor:
- operation.database_backwards("test_rnmo", editor, new_state, project_state)
+ self.unapply_operations("test_rnmo", project_state, [operation])
self.assertTableExists("test_rnmo_pony")
self.assertTableNotExists("test_rnmo_horse")
if connection.features.supports_foreign_keys: