Skip to content

Commit

Permalink
Refs #26709 -- Added index name to AddIndex.describe().
Browse files Browse the repository at this point in the history
  • Loading branch information
akki authored and timgraham committed Aug 16, 2016
1 parent 7c9bd07 commit a71724c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion django/db/migrations/operations/models.py
Expand Up @@ -795,7 +795,8 @@ def deconstruct(self):
)

def describe(self):
return 'Create index on field(s) %s of model %s' % (
return 'Create index %s on field(s) %s of model %s' % (
self.index.name,
', '.join(self.index.fields),
self.model_name,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/migrations/test_operations.py
Expand Up @@ -1405,7 +1405,7 @@ def test_add_index(self):
migrations.AddIndex("Pony", models.Index(fields=["pink"]))
index = models.Index(fields=["pink"], name="test_adin_pony_pink_idx")
operation = migrations.AddIndex("Pony", index)
self.assertEqual(operation.describe(), "Create index on field(s) pink of model Pony")
self.assertEqual(operation.describe(), "Create index test_adin_pony_pink_idx on field(s) pink of model Pony")
new_state = project_state.clone()
operation.state_forwards("test_adin", new_state)
# Test the database alteration
Expand Down

0 comments on commit a71724c

Please sign in to comment.