Skip to content

Commit b671038

Browse files
authored
Change hint message for field-choices-constraint
`check=` was deprecated in Django5.1 See https://github.com/django/django/blob/55855bc6d0d2a270eb34952c578ee352389367ad/django/db/models/constraints.py#L165-L170
1 parent 8acb037 commit b671038

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/extra_checks/checks/model_field_checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,6 @@ def apply(
308308
check = f'models.Q({in_name}=[{", ".join([self._repr_choice(c) for c in field_choices])}])'
309309
yield self.message(
310310
"Field with choices must have companion CheckConstraint to enforce choices on database level.",
311-
hint=f'Add to Meta.constraints: `models.CheckConstraint(name="%(app_label)s_%(class)s_{field.name}_valid", check={check})`',
311+
hint=f'Add to Meta.constraints: `models.CheckConstraint(name="%(app_label)s_%(class)s_{field.name}_valid", condition={check})`',
312312
obj=field,
313313
)

0 commit comments

Comments
 (0)