mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #29178 -- Allowed Index.fields to accept a tuple.
This commit is contained in:
parent
8411e4a8fe
commit
10c0fe528a
3 changed files with 14 additions and 7 deletions
|
@ -21,7 +21,7 @@ options`_.
|
|||
``Index`` options
|
||||
=================
|
||||
|
||||
.. class:: Index(fields=[], name=None, db_tablespace=None)
|
||||
.. class:: Index(fields=(), name=None, db_tablespace=None)
|
||||
|
||||
Creates an index (B-Tree) in the database.
|
||||
|
||||
|
@ -30,7 +30,7 @@ options`_.
|
|||
|
||||
.. attribute:: Index.fields
|
||||
|
||||
A list of the name of the fields on which the index is desired.
|
||||
A list or tuple of the name of the fields on which the index is desired.
|
||||
|
||||
By default, indexes are created with an ascending order for each column. To
|
||||
define an index with a descending order for a column, add a hyphen before the
|
||||
|
@ -40,6 +40,10 @@ For example ``Index(fields=['headline', '-pub_date'])`` would create SQL with
|
|||
``(headline, pub_date DESC)``. Index ordering isn't supported on MySQL. In that
|
||||
case, a descending index is created as a normal index.
|
||||
|
||||
.. versionchanged:: 2.1
|
||||
|
||||
Older versions don't accept a tuple.
|
||||
|
||||
``name``
|
||||
--------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue