1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Refs #27236 -- Reverted AlterIndexTogether deprecation.

This partly reverts a6385b382e.
This commit is contained in:
Mariusz Felisiak 2022-07-20 07:33:03 +02:00
parent 7bdb682215
commit c773d5794e
14 changed files with 0 additions and 92 deletions

View File

@ -615,14 +615,6 @@ class AlterIndexTogether(AlterTogetherOptionOperation):
option_name = "index_together"
system_check_deprecated_details = {
"msg": (
"AlterIndexTogether is deprecated. Support for it (except in historical "
"migrations) will be removed in Django 5.1."
),
"id": "migrations.W001",
}
def __init__(self, name, index_together):
super().__init__(name, index_together)

View File

@ -19,9 +19,6 @@ details on these changes.
* The model's ``Meta.index_together`` option will be removed.
* The ``AlterIndexTogether`` migration operation will be removed. A stub
operation will remain for compatibility with historical migrations.
* The ``length_is`` template filter will be removed.
* The ``django.contrib.auth.hashers.SHA1PasswordHasher``,

View File

@ -397,12 +397,6 @@ Models
* **models.W045**: Check constraint ``<constraint>`` contains ``RawSQL()``
expression and won't be validated during the model ``full_clean()``.
Migrations
----------
* **migrations.W001**: ``AlterIndexTogether`` is deprecated. Support for it
(except in historical migrations) will be removed in Django 5.1.
Security
--------

View File

@ -106,13 +106,6 @@ Changes the model's set of custom indexes (the
:attr:`~django.db.models.Options.index_together` option on the ``Meta``
subclass).
.. deprecated:: 4.2
``AlterIndexTogether`` is deprecated in favor of
:class:`~django.db.migrations.operations.AddIndex`,
:class:`~django.db.migrations.operations.RemoveIndex`, and
:class:`~django.db.migrations.operations.RenameIndex` operations.
``AlterOrderWithRespectTo``
---------------------------

View File

@ -319,8 +319,6 @@ Miscellaneous
<https://docs.python.org/3/library/secrets.html#recipes-and-best-practices>`_
for using Python's :py:mod:`secrets` module to generate passwords.
* The ``AlterIndexTogether`` migration operation is deprecated.
* The ``length_is`` template filter is deprecated in favor of :tfilter:`length`
and the ``==`` operator within an :ttag:`{% if %}<if>` tag. For example

View File

@ -1,5 +0,0 @@
from django.apps import AppConfig
class IndexTogetherAppConfig(AppConfig):
name = "check_framework.migrations_test_apps.index_together_app"

View File

@ -1,16 +0,0 @@
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
operations = [
migrations.CreateModel(
"SimpleModel",
[
("field", models.IntegerField()),
],
),
migrations.AlterIndexTogether("SimpleModel", index_together=(("id", "field"),)),
]

View File

@ -1,11 +1,7 @@
from unittest.mock import ANY
from django.core import checks
from django.core.checks.migrations import check_migration_operations
from django.db import migrations
from django.db.migrations.operations.base import Operation
from django.test import TestCase
from django.test.utils import override_settings
class DeprecatedMigrationOperationTests(TestCase):
@ -54,23 +50,6 @@ class DeprecatedMigrationOperationTests(TestCase):
],
)
@override_settings(
INSTALLED_APPS=["check_framework.migrations_test_apps.index_together_app"]
)
def tests_check_alter_index_together(self):
errors = check_migration_operations()
self.assertEqual(
errors,
[
checks.Warning(
"AlterIndexTogether is deprecated. Support for it (except in "
"historical migrations) will be removed in Django 5.1.",
obj=ANY,
id="migrations.W001",
)
],
)
class RemovedMigrationOperationTests(TestCase):
def test_default_operation(self):

View File

@ -3353,7 +3353,6 @@ class OperationTests(OperationTestBase):
definition[2], {"name": "Pony", "index_together": {("pink", "weight")}}
)
# RemovedInDjango51Warning.
def test_alter_index_together_remove(self):
operation = migrations.AlterIndexTogether("Pony", None)
self.assertEqual(

View File

@ -211,7 +211,6 @@ class OptimizerTests(SimpleTestCase):
migrations.AlterUniqueTogether("Foo", [["a", "b"]])
)
# RemovedInDjango51Warning.
def test_create_alter_index_delete_model(self):
self._test_create_alter_foo_delete_model(
migrations.AlterIndexTogether("Foo", [["a", "b"]])
@ -249,7 +248,6 @@ class OptimizerTests(SimpleTestCase):
migrations.AlterUniqueTogether("Foo", [["a", "c"]]),
)
# RemovedInDjango51Warning.
def test_alter_alter_index_model(self):
self._test_alter_alter_model(
migrations.AlterIndexTogether("Foo", [["a", "b"]]),
@ -1057,7 +1055,6 @@ class OptimizerTests(SimpleTestCase):
migrations.AlterUniqueTogether("Foo", [["a", "b"]])
)
# RemovedInDjango51Warning.
def test_create_alter_index_field(self):
self._test_create_alter_foo_field(
migrations.AlterIndexTogether("Foo", [["a", "b"]])

View File

@ -1,20 +0,0 @@
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"]