summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-06-27 19:39:37 +0200
committerTim Graham <timograham@gmail.com>2017-06-27 13:39:37 -0400
commit617505ca892fc84c7be1c224ebca2c27f93e8f50 (patch)
treef55bfbb02792f4ddef386f7609ea6f6f27287741 /django
parentd381914aef50e04ca44b9d7bb9274c8351f5b9bf (diff)
Fixed #28330 -- Prevented passing positional arguments to an Index.
Thanks Tim Graham for the review.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/postgres/indexes.py8
-rw-r--r--django/db/models/indexes.py2
2 files changed, 5 insertions, 5 deletions
diff --git a/django/contrib/postgres/indexes.py b/django/contrib/postgres/indexes.py
index 7c687987db..b7ca1d3dc4 100644
--- a/django/contrib/postgres/indexes.py
+++ b/django/contrib/postgres/indexes.py
@@ -11,11 +11,11 @@ class BrinIndex(Index):
# applicable.
max_name_length = 31
- def __init__(self, fields=[], name=None, pages_per_range=None):
+ def __init__(self, *, pages_per_range=None, **kwargs):
if pages_per_range is not None and pages_per_range <= 0:
raise ValueError('pages_per_range must be None or a positive integer')
self.pages_per_range = pages_per_range
- super().__init__(fields, name)
+ super().__init__(**kwargs)
def deconstruct(self):
path, args, kwargs = super().deconstruct()
@@ -33,10 +33,10 @@ class BrinIndex(Index):
class GinIndex(Index):
suffix = 'gin'
- def __init__(self, fields=[], name=None, fastupdate=None, gin_pending_list_limit=None):
+ def __init__(self, *, fastupdate=None, gin_pending_list_limit=None, **kwargs):
self.fastupdate = fastupdate
self.gin_pending_list_limit = gin_pending_list_limit
- super().__init__(fields, name)
+ super().__init__(**kwargs)
def deconstruct(self):
path, args, kwargs = super().deconstruct()
diff --git a/django/db/models/indexes.py b/django/db/models/indexes.py
index 7e5b8bca30..4c1aeccfab 100644
--- a/django/db/models/indexes.py
+++ b/django/db/models/indexes.py
@@ -11,7 +11,7 @@ class Index:
# cross-database compatibility with Oracle)
max_name_length = 30
- def __init__(self, fields=[], name=None):
+ def __init__(self, *, fields=[], name=None):
if not isinstance(fields, list):
raise ValueError('Index.fields must be a list.')
if not fields: