diff --git a/django-stubs/contrib/postgres/constraints.pyi b/django-stubs/contrib/postgres/constraints.pyi index dc93f0d11..c57042fd0 100644 --- a/django-stubs/contrib/postgres/constraints.pyi +++ b/django-stubs/contrib/postgres/constraints.pyi @@ -19,4 +19,5 @@ class ExclusionConstraint(BaseConstraint): deferrable: Deferrable | None = ..., include: list[str] | tuple[str] | None = ..., opclasses: list[str] | tuple[str] = ..., + violation_error_message: str | None = ... ) -> None: ... diff --git a/django-stubs/db/models/constraints.pyi b/django-stubs/db/models/constraints.pyi index ab7d94d3b..f7b2d45b1 100644 --- a/django-stubs/db/models/constraints.pyi +++ b/django-stubs/db/models/constraints.pyi @@ -14,7 +14,8 @@ class Deferrable(Enum): class BaseConstraint: name: str - def __init__(self, name: str) -> None: ... + violation_error_message: str | None + def __init__(self, name: str, violation_error_message: str | None = ...) -> None: ... def constraint_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... def create_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... def remove_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... @@ -23,7 +24,7 @@ class BaseConstraint: class CheckConstraint(BaseConstraint): check: Q - def __init__(self, *, check: Q, name: str) -> None: ... + def __init__(self, *, check: Q, name: str, violation_error_message: str | None = ...) -> None: ... class UniqueConstraint(BaseConstraint): expressions: tuple[Combinable, ...] @@ -41,6 +42,7 @@ class UniqueConstraint(BaseConstraint): deferrable: Deferrable | None = ..., include: Sequence[str] | None = ..., opclasses: Sequence[Any] = ..., + violation_error_message: str | None = ... ) -> None: ... @overload def __init__( @@ -52,4 +54,5 @@ class UniqueConstraint(BaseConstraint): deferrable: Deferrable | None = ..., include: Sequence[str] | None = ..., opclasses: Sequence[Any] = ..., + violation_error_message: str | None = ... ) -> None: ...