mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.
Once the deprecation period ends CheckConstraint.check() can become the documented method that performs system checks for BaseConstraint subclasses.
This commit is contained in:
parent
f82c67aa21
commit
daf7d482db
21 changed files with 210 additions and 136 deletions
|
@ -1208,7 +1208,7 @@ class OptimizerTests(SimpleTestCase):
|
|||
|
||||
def test_add_remove_constraint(self):
|
||||
gt_constraint = models.CheckConstraint(
|
||||
check=models.Q(pink__gt=2), name="constraint_pony_pink_gt_2"
|
||||
condition=models.Q(pink__gt=2), name="constraint_pony_pink_gt_2"
|
||||
)
|
||||
self.assertOptimizesTo(
|
||||
[
|
||||
|
@ -1329,7 +1329,7 @@ class OptimizerTests(SimpleTestCase):
|
|||
|
||||
def test_create_model_add_constraint(self):
|
||||
gt_constraint = models.CheckConstraint(
|
||||
check=models.Q(weight__gt=0), name="pony_weight_gt_0"
|
||||
condition=models.Q(weight__gt=0), name="pony_weight_gt_0"
|
||||
)
|
||||
self.assertOptimizesTo(
|
||||
[
|
||||
|
@ -1363,7 +1363,8 @@ class OptimizerTests(SimpleTestCase):
|
|||
options={
|
||||
"constraints": [
|
||||
models.CheckConstraint(
|
||||
check=models.Q(weight__gt=0), name="pony_weight_gt_0"
|
||||
condition=models.Q(weight__gt=0),
|
||||
name="pony_weight_gt_0",
|
||||
),
|
||||
models.UniqueConstraint(
|
||||
"weight", name="pony_weight_unique"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue