Skip to content

Commit a868e74

Browse files
adamchainzintgr
andauthored
Allow expressions in CheckConstraint.check (#1219)
Co-authored-by: Marti Raudsepp <[email protected]>
1 parent 8ade002 commit a868e74

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

django-stubs/db/models/constraints.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from typing import Any, TypeVar, overload
55
from _typeshed import Self
66
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
77
from django.db.models.base import Model
8-
from django.db.models.expressions import Combinable
8+
from django.db.models.expressions import BaseExpression, Combinable
99
from django.db.models.query_utils import Q
1010

1111
class Deferrable(Enum):
@@ -23,8 +23,8 @@ class BaseConstraint:
2323
def clone(self: Self) -> Self: ...
2424

2525
class CheckConstraint(BaseConstraint):
26-
check: Q
27-
def __init__(self, *, check: Q, name: str, violation_error_message: str | None = ...) -> None: ...
26+
check: Q | BaseExpression
27+
def __init__(self, *, check: Q | BaseExpression, name: str, violation_error_message: str | None = ...) -> None: ...
2828

2929
class UniqueConstraint(BaseConstraint):
3030
expressions: tuple[Combinable, ...]

0 commit comments

Comments
 (0)