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.
CheckConstraint.check
1 parent fc37cca commit b2fe258Copy full SHA for b2fe258
src/extra_checks/checks/model_field_checks.py
@@ -295,10 +295,15 @@ def apply(
295
field_choices.append("")
296
in_name = f"{field.name}__in"
297
for constraint in model._meta.constraints:
298
- if isinstance(constraint, models.CheckConstraint) and isinstance(
299
- constraint.check, models.Q
300
- ):
301
- for entry in constraint.check.children:
+ if isinstance(constraint, models.CheckConstraint):
+ condition = (
+ constraint.check
+ if django.VERSION < (5, 1)
302
+ else constraint.condition
303
+ )
304
+ if not isinstance(condition, models.Q):
305
+ continue
306
+ for entry in condition.children:
307
if (
308
isinstance(entry, tuple)
309
and entry[0] == in_name
0 commit comments