Fixed #20888 -- Added support for column order in class-based indexes.

This commit is contained in:
Akshesh 2016-07-22 18:22:44 +05:30 committed by Tim Graham
parent 6b842c5998
commit 311a8e8d50
4 changed files with 60 additions and 6 deletions

View file

@ -46,6 +46,11 @@ class IndexesTests(TestCase):
index.set_name_with_model(Book)
self.assertEqual(index.name, 'model_index_author_0f5565_idx')
# '-' for DESC columns should be accounted for in the index name.
index = models.Index(fields=['-author'])
index.set_name_with_model(Book)
self.assertEqual(index.name, 'model_index_author_708765_idx')
# fields may be truncated in the name. db_column is used for naming.
long_field_index = models.Index(fields=['pages'])
long_field_index.set_name_with_model(Book)