summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorAkshesh <aksheshdoshi@gmail.com>2016-07-07 12:00:55 +0530
committerTim Graham <timograham@gmail.com>2016-07-07 07:31:23 -0400
commitb1e7d19d4c7015efe0c65361bb7f00a2f1c7047c (patch)
tree208b01df2abc364c72c4e8f8f03e8c5082efa5fe /django/db
parentf1af076fbabf932dde337f09ad95369aab32d404 (diff)
Refs #26709 -- Required a name for Indexes passed to AddIndex.
Thanks to Markush for discussions.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/migrations/operations/models.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 4c9467cc0d..888b2851da 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -751,6 +751,11 @@ class AddIndex(Operation):
def __init__(self, model_name, index):
self.model_name = model_name
+ if not index._name:
+ raise ValueError(
+ "Indexes passed to AddIndex operations require a name "
+ "argument. %r doesn't have one." % index
+ )
self.index = index
def state_forwards(self, app_label, state):