From e9a0e1d4f6ecfc4227acff74e1f56f288a0b30aa Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 15 Nov 2019 00:08:36 -0500 Subject: Fixed #30484 -- Added conditional expressions support to CheckConstraint. --- docs/ref/models/constraints.txt | 8 ++++++-- docs/releases/3.1.txt | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/ref/models/constraints.txt b/docs/ref/models/constraints.txt index 0ac54cf265..9e3119f600 100644 --- a/docs/ref/models/constraints.txt +++ b/docs/ref/models/constraints.txt @@ -52,12 +52,16 @@ option. .. attribute:: CheckConstraint.check -A :class:`Q` object that specifies the check you want the constraint to -enforce. +A :class:`Q` object or boolean :class:`~django.db.models.Expression` that +specifies the check you want the constraint to enforce. For example, ``CheckConstraint(check=Q(age__gte=18), name='age_gte_18')`` ensures the age field is never less than 18. +.. versionchanged:: 3.1 + + Support for boolean :class:`~django.db.models.Expression` was added. + ``name`` -------- diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt index 16f9ed01be..bff16dc1ab 100644 --- a/docs/releases/3.1.txt +++ b/docs/releases/3.1.txt @@ -204,6 +204,8 @@ Models ``OneToOneField`` emulates the behavior of the SQL constraint ``ON DELETE RESTRICT``. +* :attr:`.CheckConstraint.check` now supports boolean expressions. + Pagination ~~~~~~~~~~ -- cgit v1.3