We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4b241c commit 91e69b3Copy full SHA for 91e69b3
src/extra_checks/checks/model_field_checks.py
@@ -306,8 +306,9 @@ def apply(
306
):
307
return
308
check = f'models.Q({in_name}=[{", ".join([self._repr_choice(c) for c in field_choices])}])'
309
+ arg_name = "condition" if django.VERSION >= (5, 1) else "check"
310
yield self.message(
311
"Field with choices must have companion CheckConstraint to enforce choices on database level.",
- hint=f'Add to Meta.constraints: `models.CheckConstraint(name="%(app_label)s_%(class)s_{field.name}_valid", condition={check})`',
312
+ hint=f'Add to Meta.constraints: `models.CheckConstraint(name="%(app_label)s_%(class)s_{field.name}_valid", {arg_name}={check})`',
313
obj=field,
314
)
0 commit comments