mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
a6385b382e
This also deprecates AlterIndexTogether migration operation.
21 lines
688 B
Python
21 lines
688 B
Python
from django.db import models
|
|
from django.test import TestCase
|
|
from django.utils.deprecation import RemovedInDjango51Warning
|
|
|
|
|
|
class IndexTogetherDeprecationTests(TestCase):
|
|
def test_warning(self):
|
|
msg = (
|
|
"'index_together' is deprecated. Use 'Meta.indexes' in "
|
|
"'model_options.MyModel' instead."
|
|
)
|
|
with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
|
|
|
|
class MyModel(models.Model):
|
|
field_1 = models.IntegerField()
|
|
field_2 = models.IntegerField()
|
|
|
|
class Meta:
|
|
app_label = "model_options"
|
|
index_together = ["field_1", "field_2"]
|