1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #36660 -- Fixed a regression in descending Index local field checks.

Regression in 8638d8bf74.

Refs #36273.

Thanks Federico Bond for the report.
This commit is contained in:
Simon Charette
2025-10-12 12:57:32 -04:00
committed by nessita
parent 0f75f8f1ff
commit edde2891c3
2 changed files with 15 additions and 1 deletions

View File

@@ -114,7 +114,12 @@ class Index:
)
errors.extend(
model._check_local_fields(
{*self.fields, *self.include, *references}, "indexes"
{
*[field for field, _ in self.fields_orders],
*self.include,
*references,
},
"indexes",
)
)
# Database-feature checks:

View File

@@ -185,6 +185,15 @@ class IndexesTests(TestCase):
],
)
def test_pointing_to_desc_field(self):
class Model(models.Model):
name = models.CharField(max_length=100)
class Meta:
indexes = [models.Index(fields=["-name"], name="index_name")]
self.assertEqual(Model.check(databases=self.databases), [])
def test_pointing_to_m2m_field(self):
class Model(models.Model):
m2m = models.ManyToManyField("self")