Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 5.1 Support - deprecated index_together #567

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

whoisearth
Copy link

Fix pulled from Django 4.2 release notes here -

https://docs.djangoproject.com/en/5.1/releases/4.2/#deprecated-features-4-2

Migrating existing index_together should be handled as a migration. For example:

class Author(models.Model):
    rank = models.IntegerField()
    name = models.CharField(max_length=30)

    class Meta:
        index_together = [["rank", "name"]]

Should become:

class Author(models.Model):
    rank = models.IntegerField()
    name = models.CharField(max_length=30)

    class Meta:
        indexes = [models.Index(fields=["rank", "name"])]

Django 5.1 ... index_together deprecated.
Django 5.1 .... index_together deprecated
@whoisearth whoisearth mentioned this pull request Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant