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 Django 5.1+ support for CheckConstraint condition with backward compatibility #108

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

JaeHyuckSa
Copy link
Contributor

@JaeHyuckSa JaeHyuckSa commented Sep 4, 2024

This PR adds support for CheckConstraint.condition in Django 5.1 while maintaining backward compatibility with Django 4.2 by dynamically selecting between condition and check based on the Django version.

…ackward compatibility with 4.2

Signed-off-by: saJaeHyukc <[email protected]>
@RealOrangeOne RealOrangeOne linked an issue Sep 4, 2024 that may be closed by this pull request
@JaeHyuckSa
Copy link
Contributor Author

@RealOrangeOne The current issue with mypy is that it indicates that condition is not defined. Should this be adjusted to match the version of django-stubs?

Here is the relevant line in django-stubs:
https://github.com/typeddjango/django-stubs/blob/df12deb6b30623c0661b920a4eece8135306b55d/django-stubs/db/models/constraints.pyi#L48C1-L67C19

@RealOrangeOne
Copy link
Owner

If there's an overload, I'm surprised this is failing. If dependencies need updating, feel free to do so. Alternatively, I'm ok adding a type ignore for these lines.

@JaeHyuckSa
Copy link
Contributor Author

If there's an overload, I'm surprised this is failing. If dependencies need updating, feel free to do so. Alternatively, I'm ok adding a type ignore for these lines.

I've added a type ignore for these lines as suggested. :)

@RealOrangeOne RealOrangeOne merged commit b12159d into RealOrangeOne:master Sep 19, 2024
39 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.

CheckConstraint.check is marked as deprecated in Django 5.1
2 participants