Skip to content

Update constaints for Django 5#266

Draft
devanubis wants to merge 1 commit intosbdchd:mainfrom
devanubis:check-constraint
Draft

Update constaints for Django 5#266
devanubis wants to merge 1 commit intosbdchd:mainfrom
devanubis:check-constraint

Conversation

@devanubis
Copy link
Copy Markdown

Django 5 added:

  • BaseConstraint.violation_error_code and corresponding __init__ parameter.
  • CheckConstraint.conditionto replacecheckand correspondinginit` parameter.
    • The use of check now emits a Django6 deprecation warning, but can't change it without updating the types.

https://github.com/django/django/blob/stable/5.1.x/django/db/models/constraints.py

@devanubis
Copy link
Copy Markdown
Author

devanubis commented Sep 4, 2024

Actually, I've just checked and django-stubs already fixed both of these, and better than me with an @overload.

Would  you prefer a cherry-pick of those as separate PRs?

Or do you have any immediate plans to update from django-stubs ? I noticed #255...

@devanubis devanubis marked this pull request as draft September 4, 2024 11:20
@mnitchie
Copy link
Copy Markdown

mnitchie commented May 2, 2025

Could you mark this as ready for review? It might get some feedback on your questions that way. I'm interested in this making it into this/pylance as well.

Thanks!

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.

2 participants