Skip to content

Commit

Permalink
fix: replace CheckConstraint.check with CheckConstraint.condition and…
Browse files Browse the repository at this point in the history
… add FORMS_URLFIELD_ASSUME_HTTPS (#1445)

* fix: change check to condition

fixes RemovedInDjango60Warning: CheckConstraint.check is deprecated in favor of `.condition`.

* fix: add FORMS_URLFIELD_ASSUME_HTTPS setting

fixes RemovedInDjango60Warning: The default scheme will be changed from 'http' to 'https' in Django 6.0. Pass the forms.URLField.assume_scheme argument to silence this warning, or set the FORMS_URLFIELD_ASSUME_HTTPS transitional setting to True to opt into using 'https' as the new default scheme.

* style: fix whitespace
  • Loading branch information
paulschreiber authored Sep 4, 2024
1 parent 6bc5931 commit 9fa3321
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="site",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
models.Q(("project__isnull", False), ("owner__isnull", False), _connector="OR"),
models.Q(("project__isnull", True), ("owner__isnull", True), _connector="OR"),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="depthdependentsoildata",
constraint=models.CheckConstraint(
check=models.Q(("depth_start__lt", models.F("depth_end"))),
condition=models.Q(("depth_start__lt", models.F("depth_end"))),
name="depth_interval_coherence",
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="depthdependentsoildata",
constraint=models.CheckConstraint(
check=models.Q(("depth_interval_start__lt", models.F("depth_interval_end"))),
condition=models.Q(("depth_interval_start__lt", models.F("depth_interval_end"))),
name="soil_id_depthdependentsoildata_depth_interval_coherence",
),
),
Expand Down Expand Up @@ -247,7 +247,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="soildatadepthinterval",
constraint=models.CheckConstraint(
check=models.Q(("depth_interval_start__lt", models.F("depth_interval_end"))),
condition=models.Q(("depth_interval_start__lt", models.F("depth_interval_end"))),
name="soil_id_soildatadepthinterval_depth_interval_coherence",
),
),
Expand All @@ -262,7 +262,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="projectdepthinterval",
constraint=models.CheckConstraint(
check=models.Q(("depth_interval_start__lt", models.F("depth_interval_end"))),
condition=models.Q(("depth_interval_start__lt", models.F("depth_interval_end"))),
name="soil_id_projectdepthinterval_depth_interval_coherence",
),
),
Expand Down
2 changes: 1 addition & 1 deletion terraso_backend/apps/soil_id/models/depth_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def constraints(related_field: str):
name="%(app_label)s_%(class)s_unique_depth_interval",
),
models.CheckConstraint(
check=models.Q(depth_interval_start__lt=models.F("depth_interval_end")),
condition=models.Q(depth_interval_start__lt=models.F("depth_interval_end")),
name="%(app_label)s_%(class)s_depth_interval_coherence",
),
]
Expand Down
3 changes: 3 additions & 0 deletions terraso_backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,6 @@ class JWTProvider(TypedDict):
f"https://api.hsforms.com/submissions/v3/integration/submit/"
f"{HUBSPOT_PORTAL_ID}/{HUBSPOT_ACCOUNT_DELETION_FORM_ID}"
)

# Neeed for Django 5.x to silence warning. Remove when Django 6.0 is released.
FORMS_URLFIELD_ASSUME_HTTPS = True

0 comments on commit 9fa3321

Please sign in to comment.