Model index referenceLink to this heading
Index classes ease creating database indexes. They can be added using the
Meta.indexes option. This document
explains the API references of Index which includes the index
options.
Pilihan IndexLink to this heading
- class Index(fields=[], name=None)Link to this definition
Membuat sebuah index (B-tree) dalam basisdata.
fieldsLink to this heading
- Index.fieldsLink to this definition
A list 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 field's name.
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.
nameLink to this heading
- Index.nameLink to this definition
The name of the index. If name isn't provided Django will auto-generate a
name. For compatibility with different databases, index names cannot be longer
than 30 characters and shouldn't start with a number (0-9) or underscore (_).