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

Add checks for depreciated attributes. #200

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

geoffrey-eisenbarth
Copy link
Contributor

Fixes #198. Passed tests both for Django 4.2.14 and 5.1.1 (with the additional change that MockObject.Meta.index_together is replaced with model.Index(fields=["name", "number"])).

@palewire
Copy link
Owner

palewire commented Sep 6, 2024

Thanks for this. I'm bumping our tests to run against 5.1 too.

@palewire
Copy link
Owner

palewire commented Sep 6, 2024

Would you mind adding your MockObject trick yet too? I suspect it will then pass the tests and we can merge.

@geoffrey-eisenbarth
Copy link
Contributor Author

Would you mind adding your MockObject trick yet too? I suspect it will then pass the tests and we can merge.

Is there a straightforward way to use the original MockObject (with index_together) when testing against Django < 5.1 and use a different object (with model.Index) for >= 5.1?

Or should we just update MockObject to use model.Index (which would pass on earlier versions of Django, but not cover the situation where index_together is actually used).

@palewire
Copy link
Owner

palewire commented Sep 6, 2024

Could this help you do the first?

import django
django.get_version()

@geoffrey-eisenbarth
Copy link
Contributor Author

It's not the cleanest, imo, since we have to override models.Model.__init__(), but I think that's necessary until you decide to drop support for Django < 5.1.

@palewire palewire merged commit 1f41812 into palewire:main Sep 6, 2024
14 checks passed
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.

UniqueConstraints and Django 5
2 participants