not possible to validate a many-to-many at the model
|Reported by:||ryazwinski||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.1|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by )
Reference ticket #12065 for genesis of this ticket.
It isn't currently possible to perform model-level validation of many-to-many relationships.
class Test(models.Model): f1 = models.CharField(max_length=100) m2m = models.ManyToManyField(Other)
It is not possible to ensure that the f1/m2m relationship is unique. Validation in the Test class cannot validate the m2m because Test won't have been saved yet.