mirror of
https://github.com/ae-utbm/sith.git
synced 2025-08-29 04:05:48 +00:00
Merge pull request #1157 from ae-utbm/checkconstraint
replace deprecated CheckConstraint.check by CheckConstraint.condition
This commit is contained in:
@@ -29,7 +29,7 @@ class Migration(migrations.Migration):
|
||||
migrations.AddConstraint(
|
||||
model_name="membership",
|
||||
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",
|
||||
),
|
||||
),
|
||||
|
@@ -347,7 +347,7 @@ class Membership(models.Model):
|
||||
class Meta:
|
||||
constraints = [
|
||||
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(
|
||||
model_name="newsdate",
|
||||
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",
|
||||
),
|
||||
),
|
||||
|
@@ -212,7 +212,7 @@ class NewsDate(models.Model):
|
||||
verbose_name_plural = _("news dates")
|
||||
constraints = [
|
||||
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",
|
||||
)
|
||||
]
|
||||
|
@@ -154,7 +154,7 @@ class Migration(migrations.Migration):
|
||||
migrations.AddConstraint(
|
||||
model_name="userban",
|
||||
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",
|
||||
),
|
||||
),
|
||||
|
@@ -745,7 +745,7 @@ class UserBan(models.Model):
|
||||
fields=["ban_group", "user"], name="unique_ban_type_per_user"
|
||||
),
|
||||
models.CheckConstraint(
|
||||
check=Q(expires_at__gte=F("created_at")),
|
||||
condition=Q(expires_at__gte=F("created_at")),
|
||||
name="user_ban_end_after_start",
|
||||
),
|
||||
]
|
||||
|
@@ -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",
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user