summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-09-17 08:26:18 +0200
committerTim Graham <timograham@gmail.com>2017-09-18 14:22:33 -0400
commitcee07ba0880e9d1396795e4823a7371da90cc5cc (patch)
tree815468e42d3070a762a884e5605cc74691f22c70 /tests
parenta86d95726bdf84efaba7f30c44edddf6c34d2c2e (diff)
[1.11.x] Fixed #28597 -- Fixed crash with the name of a model's autogenerated primary key in an Index's fields.
Backport of fb02ebe889eee292144f9157ed4ddcdcc139eba9 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/model_indexes/models.py6
-rw-r--r--tests/model_indexes/tests.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/model_indexes/models.py b/tests/model_indexes/models.py
index 6d74ad8fa6..0fa998843e 100644
--- a/tests/model_indexes/models.py
+++ b/tests/model_indexes/models.py
@@ -5,9 +5,13 @@ class Book(models.Model):
title = models.CharField(max_length=50)
author = models.CharField(max_length=50)
pages = models.IntegerField(db_column='page_count')
+ isbn = models.CharField(max_length=50, db_tablespace='idx_tbls')
class Meta:
- indexes = [models.indexes.Index(fields=['title'])]
+ indexes = [
+ models.indexes.Index(fields=['title']),
+ models.indexes.Index(fields=['isbn', 'id']),
+ ]
class AbstractModel(models.Model):
diff --git a/tests/model_indexes/tests.py b/tests/model_indexes/tests.py
index c0f5a84fdb..74c7cf45f4 100644
--- a/tests/model_indexes/tests.py
+++ b/tests/model_indexes/tests.py
@@ -85,7 +85,7 @@ class IndexesTests(SimpleTestCase):
def test_name_set(self):
index_names = [index.name for index in Book._meta.indexes]
- self.assertEqual(index_names, ['model_index_title_196f42_idx'])
+ self.assertCountEqual(index_names, ['model_index_title_196f42_idx', 'model_index_isbn_34f975_idx'])
def test_abstract_children(self):
index_names = [index.name for index in ChildModel1._meta.indexes]