2
0
Эх сурвалжийг харах

Changed django.db.models.indexes.Index imports to django.db.models.Index.

Mariusz Felisiak 5 жил өмнө
parent
commit
8233144ca0

+ 2 - 2
tests/migrations/test_state.py

@@ -1105,7 +1105,7 @@ class ModelStateTests(SimpleTestCase):
             class Meta:
                 app_label = 'migrations'
                 abstract = True
-                indexes = [models.indexes.Index(fields=['name'])]
+                indexes = [models.Index(fields=['name'])]
 
         class Child1(Abstract):
             pass
@@ -1131,7 +1131,7 @@ class ModelStateTests(SimpleTestCase):
 
             class Meta:
                 app_label = 'migrations'
-                indexes = [models.indexes.Index(fields=['name'], name='foo_idx')]
+                indexes = [models.Index(fields=['name'], name='foo_idx')]
 
         model_state = ModelState.from_model(TestModel)
         index_names = [index.name for index in model_state.options['indexes']]

+ 3 - 3
tests/model_indexes/models.py

@@ -10,8 +10,8 @@ class Book(models.Model):
 
     class Meta:
         indexes = [
-            models.indexes.Index(fields=['title']),
-            models.indexes.Index(fields=['isbn', 'id']),
+            models.Index(fields=['title']),
+            models.Index(fields=['isbn', 'id']),
         ]
 
 
@@ -20,7 +20,7 @@ class AbstractModel(models.Model):
 
     class Meta:
         abstract = True
-        indexes = [models.indexes.Index(fields=['name'])]
+        indexes = [models.Index(fields=['name'])]
 
 
 class ChildModel1(AbstractModel):

+ 1 - 2
tests/schema/tests.py

@@ -8,7 +8,7 @@ from django.core.management.color import no_style
 from django.db import (
     DatabaseError, IntegrityError, OperationalError, connection,
 )
-from django.db.models import Model, Q
+from django.db.models import Index, Model, Q
 from django.db.models.constraints import CheckConstraint, UniqueConstraint
 from django.db.models.deletion import CASCADE, PROTECT
 from django.db.models.fields import (
@@ -19,7 +19,6 @@ from django.db.models.fields import (
 from django.db.models.fields.related import (
     ForeignKey, ForeignObject, ManyToManyField, OneToOneField,
 )
-from django.db.models.indexes import Index
 from django.db.transaction import TransactionManagementError, atomic
 from django.db.utils import DataError
 from django.test import (