diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2017-12-05 21:05:10 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2017-12-05 22:42:58 +0100 |
| commit | 3e52fd7595f80ec162fc44798c29399b7e899b9b (patch) | |
| tree | 090bddcb5bd9c874aaa2bad1720aca89766a9861 /django | |
| parent | 47681af34447e5d45f3fdb316497cdf9fbd0b7ce (diff) | |
[1.11.x] Refs #28876 -- Fixed incorrect class-based model index name generation for models with quoted db_table.
Thanks Simon Charette and Tim Graham for the review and Carlos E. C.
Leite for the report.
Backport of f79d9a322c6008e5fada1453aebfb56afc316cc8 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/indexes.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/indexes.py b/django/db/models/indexes.py index 0ee2bf3610..7cda26508e 100644 --- a/django/db/models/indexes.py +++ b/django/db/models/indexes.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals import hashlib +from django.db.backends.utils import split_identifier from django.utils.encoding import force_bytes __all__ = [str('Index')] @@ -101,7 +102,7 @@ class Index(object): (8 chars) and unique hash + suffix (10 chars). Each part is made to fit its size by truncating the excess length. """ - table_name = model._meta.db_table + _, table_name = split_identifier(model._meta.db_table) column_names = [model._meta.get_field(field_name).column for field_name, order in self.fields_orders] column_names_with_order = [ (('-%s' if order else '%s') % column_name) |
