From 7ef03edd930426e9b3dd517dbc12e3b73d84a4ac Mon Sep 17 00:00:00 2001 From: Howard Cox Date: Wed, 4 Sep 2024 12:14:52 +0100 Subject: [PATCH] Update constaints for Django 5 --- django-stubs/db/models/constraints.pyi | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/django-stubs/db/models/constraints.pyi b/django-stubs/db/models/constraints.pyi index 61435013c..7b714356f 100644 --- a/django-stubs/db/models/constraints.pyi +++ b/django-stubs/db/models/constraints.pyi @@ -14,10 +14,13 @@ class Deferrable(Enum): class BaseConstraint: name: str + violation_error_code: str | None + violation_error_message: str | None def __init__( self, *args: BaseExpression | Combinable | str, name: str | None = ..., + violation_error_code: str | None = ..., violation_error_message: str | None = ..., ) -> None: ... def constraint_sql( @@ -39,12 +42,15 @@ class BaseConstraint: def clone(self) -> Self: ... class CheckConstraint(BaseConstraint): - check: Q + condition: Q + check: Q | None def __init__( self, *, - check: Q, name: str, + condition: Q | None = ..., + check: Q | None = ..., + violation_error_code: str | None = ..., violation_error_message: str | None = ..., ) -> None: ... @@ -60,6 +66,7 @@ class UniqueConstraint(BaseConstraint): deferrable: Deferrable | None = ..., include: str | Sequence[str] | None = ..., opclasses: Sequence[str] = ..., - violation_error_message: str | None = ..., nulls_distinct: bool | None = ..., + violation_error_code: str | None = ..., + violation_error_message: str | None = ..., ) -> None: ...