I would like to add database constraints to my model, that require at least one of its fields to be not-null. When checking the m2m field, I get a FieldError: Cannot resolve keyword '' into field.
Is it possible to create such constraints?
Sample code:
class A(Model):
id = AutoField()
url = ManyToManyField(Url, blank=True)
description = TextField(null=True, blank=True)
class Meta:
constraints = [CheckConstraints(
check=(Q(description__isnull=False) | Q(url__isnull=False))),
name="someName"
)]