replace deprecated CheckConstraint.check by CheckConstraint.condition

This commit is contained in:
imperosol
2025-08-28 16:31:54 +02:00
parent 23103950b8
commit e864e82573
8 changed files with 8 additions and 8 deletions

View File

@@ -58,7 +58,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="returnableproduct",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
("product", models.F("returned_product")), _negated=True
),
name="returnableproduct_product_different_from_returned",

View File

@@ -1278,7 +1278,7 @@ class ReturnableProduct(models.Model):
verbose_name_plural = _("returnable products")
constraints = [
models.CheckConstraint(
check=~Q(product=F("returned_product")),
condition=~Q(product=F("returned_product")),
name="returnableproduct_product_different_from_returned",
violation_error_message=_(
"The returnable product cannot be the same as the returned one"