diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 1c2f209..1ded7c6 100644
|
a
|
b
|
class AlterUniqueTogether(Operation):
|
| 248 | 248 | return name.lower() == self.name.lower() |
| 249 | 249 | |
| 250 | 250 | def describe(self): |
| 251 | | return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.unique_together)) |
| | 251 | return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.unique_together or '')) |
| 252 | 252 | |
| 253 | 253 | |
| 254 | 254 | class AlterIndexTogether(Operation): |
| … |
… |
class AlterIndexTogether(Operation):
|
| 288 | 288 | return name.lower() == self.name.lower() |
| 289 | 289 | |
| 290 | 290 | def describe(self): |
| 291 | | return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.index_together)) |
| | 291 | return "Alter %s for %s (%s constraint(s))" % (self.option_name, self.name, len(self.index_together or '')) |
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | class AlterOrderWithRespectTo(Operation): |
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py
index ab1c39f..c26153a 100644
|
a
|
b
|
class ModelState(object):
|
| 273 | 273 | meta_contents = {'app_label': self.app_label, "apps": apps} |
| 274 | 274 | meta_contents.update(self.options) |
| 275 | 275 | if "unique_together" in meta_contents: |
| 276 | | meta_contents["unique_together"] = list(meta_contents["unique_together"]) |
| | 276 | meta_contents["unique_together"] = list(meta_contents["unique_together"]) if meta_contents["unique_together"] is not None else None |
| 277 | 277 | meta = type(str("Meta"), tuple(), meta_contents) |
| 278 | 278 | # Then, work out our bases |
| 279 | 279 | try: |
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 5444dae..b8d1ae5 100644
|
a
|
b
|
class OperationTests(OperationTestBase):
|
| 899 | 899 | operation.state_forwards("test_alunto", new_state) |
| 900 | 900 | self.assertEqual(len(new_state.models["test_alunto", "pony"].options.get("unique_together", set())), 1) |
| 901 | 901 | |
| | 902 | def test_alter_unique_together_remove(self): |
| | 903 | operation = migrations.AlterUniqueTogether("Pony", None) |
| | 904 | self.assertEqual(operation.describe(), "Alter unique_together for Pony (0 constraint(s))") |
| | 905 | |
| 902 | 906 | def test_alter_index_together(self): |
| 903 | 907 | """ |
| 904 | 908 | Tests the AlterIndexTogether operation. |
| … |
… |
class OperationTests(OperationTestBase):
|
| 922 | 926 | operation.database_backwards("test_alinto", editor, new_state, project_state) |
| 923 | 927 | self.assertIndexNotExists("test_alinto_pony", ["pink", "weight"]) |
| 924 | 928 | |
| | 929 | def test_alter_index_together_remove(self): |
| | 930 | operation = migrations.AlterIndexTogether("Pony", None) |
| | 931 | self.assertEqual(operation.describe(), "Alter index_together for Pony (0 constraint(s))") |
| | 932 | |
| 925 | 933 | def test_alter_model_options(self): |
| 926 | 934 | """ |
| 927 | 935 | Tests the AlterModelOptions operation. |