mirror of
https://github.com/ae-utbm/sith.git
synced 2025-08-29 12:15:44 +00:00
replace deprecated CheckConstraint.check by CheckConstraint.condition
This commit is contained in:
@@ -29,7 +29,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddConstraint(
|
migrations.AddConstraint(
|
||||||
model_name="membership",
|
model_name="membership",
|
||||||
constraint=models.CheckConstraint(
|
constraint=models.CheckConstraint(
|
||||||
check=models.Q(("end_date__gte", models.F("start_date"))),
|
condition=models.Q(("end_date__gte", models.F("start_date"))),
|
||||||
name="end_after_start",
|
name="end_after_start",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -347,7 +347,7 @@ class Membership(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
constraints = [
|
constraints = [
|
||||||
models.CheckConstraint(
|
models.CheckConstraint(
|
||||||
check=Q(end_date__gte=F("start_date")), name="end_after_start"
|
condition=Q(end_date__gte=F("start_date")), name="end_after_start"
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddConstraint(
|
migrations.AddConstraint(
|
||||||
model_name="newsdate",
|
model_name="newsdate",
|
||||||
constraint=models.CheckConstraint(
|
constraint=models.CheckConstraint(
|
||||||
check=models.Q(("end_date__gte", models.F("start_date"))),
|
condition=models.Q(("end_date__gte", models.F("start_date"))),
|
||||||
name="news_date_end_date_after_start_date",
|
name="news_date_end_date_after_start_date",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -212,7 +212,7 @@ class NewsDate(models.Model):
|
|||||||
verbose_name_plural = _("news dates")
|
verbose_name_plural = _("news dates")
|
||||||
constraints = [
|
constraints = [
|
||||||
models.CheckConstraint(
|
models.CheckConstraint(
|
||||||
check=Q(end_date__gte=F("start_date")),
|
condition=Q(end_date__gte=F("start_date")),
|
||||||
name="news_date_end_date_after_start_date",
|
name="news_date_end_date_after_start_date",
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@@ -154,7 +154,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddConstraint(
|
migrations.AddConstraint(
|
||||||
model_name="userban",
|
model_name="userban",
|
||||||
constraint=models.CheckConstraint(
|
constraint=models.CheckConstraint(
|
||||||
check=models.Q(("expires_at__gte", models.F("created_at"))),
|
condition=models.Q(("expires_at__gte", models.F("created_at"))),
|
||||||
name="user_ban_end_after_start",
|
name="user_ban_end_after_start",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -745,7 +745,7 @@ class UserBan(models.Model):
|
|||||||
fields=["ban_group", "user"], name="unique_ban_type_per_user"
|
fields=["ban_group", "user"], name="unique_ban_type_per_user"
|
||||||
),
|
),
|
||||||
models.CheckConstraint(
|
models.CheckConstraint(
|
||||||
check=Q(expires_at__gte=F("created_at")),
|
condition=Q(expires_at__gte=F("created_at")),
|
||||||
name="user_ban_end_after_start",
|
name="user_ban_end_after_start",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@@ -58,7 +58,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddConstraint(
|
migrations.AddConstraint(
|
||||||
model_name="returnableproduct",
|
model_name="returnableproduct",
|
||||||
constraint=models.CheckConstraint(
|
constraint=models.CheckConstraint(
|
||||||
check=models.Q(
|
condition=models.Q(
|
||||||
("product", models.F("returned_product")), _negated=True
|
("product", models.F("returned_product")), _negated=True
|
||||||
),
|
),
|
||||||
name="returnableproduct_product_different_from_returned",
|
name="returnableproduct_product_different_from_returned",
|
||||||
|
@@ -1278,7 +1278,7 @@ class ReturnableProduct(models.Model):
|
|||||||
verbose_name_plural = _("returnable products")
|
verbose_name_plural = _("returnable products")
|
||||||
constraints = [
|
constraints = [
|
||||||
models.CheckConstraint(
|
models.CheckConstraint(
|
||||||
check=~Q(product=F("returned_product")),
|
condition=~Q(product=F("returned_product")),
|
||||||
name="returnableproduct_product_different_from_returned",
|
name="returnableproduct_product_different_from_returned",
|
||||||
violation_error_message=_(
|
violation_error_message=_(
|
||||||
"The returnable product cannot be the same as the returned one"
|
"The returnable product cannot be the same as the returned one"
|
||||||
|
Reference in New Issue
Block a user