mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #33996 -- Fixed CheckConstraint validation on NULL values.
Bug in 667105877e
.
Thanks James Beith for the report.
This commit is contained in:
parent
b731e88415
commit
e14d08cd89
7 changed files with 42 additions and 7 deletions
|
@ -102,6 +102,15 @@ 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.
|
||||
|
||||
.. admonition:: Oracle
|
||||
|
||||
Checks with nullable fields on Oracle must include a condition allowing for
|
||||
``NULL`` values in order for :meth:`validate() <BaseConstraint.validate>`
|
||||
to behave the same as check constraints validation. For example, if ``age``
|
||||
is a nullable field::
|
||||
|
||||
CheckConstraint(check=Q(age__gte=18) | Q(age__isnull=True), name='age_gte_18')
|
||||
|
||||
.. versionchanged:: 4.1
|
||||
|
||||
The ``violation_error_message`` argument was added.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue