summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-07-14 08:16:35 -0400
committerTim Graham <timograham@gmail.com>2014-07-15 15:21:44 -0400
commit01515ebaa45a7facc6b450f3fea77dcdbec85887 (patch)
tree7c30d464bb3c5e41a81606061f98e3aee98ca8c8 /django
parentfe5f29eb1db795257d4095df0e1547c17daadade (diff)
[1.7.x] Fixed #23013 -- Fixed removing unique_together/index_together constraints in migrations.
Thanks melinath for the report. Backport of 0154965392 from master
Diffstat (limited to 'django')
-rw-r--r--django/db/migrations/operations/models.py4
-rw-r--r--django/db/migrations/state.py2
2 files changed, 2 insertions, 4 deletions
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 1c2f209df3..1ded7c6db4 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -248,7 +248,7 @@ class AlterUniqueTogether(Operation):
return name.lower() == self.name.lower()
def describe(self):
- return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.unique_together))
+ return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.unique_together or ''))
class AlterIndexTogether(Operation):
@@ -288,7 +288,7 @@ class AlterIndexTogether(Operation):
return name.lower() == self.name.lower()
def describe(self):
- return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.index_together))
+ return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.index_together or ''))
class AlterOrderWithRespectTo(Operation):
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py
index ab1c39f8ee..d24a37e5b9 100644
--- a/django/db/migrations/state.py
+++ b/django/db/migrations/state.py
@@ -272,8 +272,6 @@ class ModelState(object):
# First, make a Meta object
meta_contents = {'app_label': self.app_label, "apps": apps}
meta_contents.update(self.options)
- if "unique_together" in meta_contents:
- meta_contents["unique_together"] = list(meta_contents["unique_together"])
meta = type(str("Meta"), tuple(), meta_contents)
# Then, work out our bases
try: