diff --git a/django-stubs/db/models/constraints.pyi b/django-stubs/db/models/constraints.pyi index 7b96ada72..988f0f4b0 100644 --- a/django-stubs/db/models/constraints.pyi +++ b/django-stubs/db/models/constraints.pyi @@ -44,11 +44,24 @@ class BaseConstraint: class CheckConstraint(BaseConstraint): check: Q | BaseExpression + condition: Q | BaseExpression + + @overload + @deprecated("The check keyword argument is deprecated in favor of condition and will be removed in Django 6.0") def __init__( self, *, + name: str, check: Q | BaseExpression, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... + @overload + def __init__( + self, + *, name: str, + condition: Q | BaseExpression, violation_error_code: str | None = None, violation_error_message: _StrOrPromise | None = None, ) -> None: ... diff --git a/tests/assert_type/db/models/test_constraints.py b/tests/assert_type/db/models/test_constraints.py index db0fce1a7..971675559 100644 --- a/tests/assert_type/db/models/test_constraints.py +++ b/tests/assert_type/db/models/test_constraints.py @@ -13,4 +13,4 @@ name="unique_mess", ) -CheckConstraint(name="less_than_constraint", check=LessThan[Any](F("months"), 1)) +CheckConstraint(name="less_than_constraint", check=LessThan[Any](F("months"), 1)) # pyright: ignore[reportDeprecated]