Skip to content

Commit

Permalink
Update constaints for Django 5
Browse files Browse the repository at this point in the history
  • Loading branch information
devanubis committed Sep 4, 2024
1 parent 7f9bd0d commit 7ef03ed
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions django-stubs/db/models/constraints.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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: ...

Expand All @@ -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: ...

0 comments on commit 7ef03ed

Please sign in to comment.