django中的自引用ManyToMany约束

时间:2013-05-31 06:36:43

标签: django constraints manytomanyfield

我有

class MyModel:
relations = models.ManyToManyField('MyModel', related_name = 'relations_reverse')

我想添加将强制实施的constraint 两端不能相同object。 (即myVar1 - myVar2 can be related but not myVar1 - myVar1

0 个答案:

没有答案