假设我有以下模型:
class Person(models.Model):
related_people = models.ManyToManyField('Person',
blank=True,
related_name='ret_related_people',
through='RelationshipType')
class RelationshipType(models.Model):
person1 = models.ForeignKey('Person', related_name='rel_back_1')
person2 = models.ForeignKey('Person', related_name='rel_back_2')
type = models.CharField(max_length=16)
有什么方法可以防止 aPerson
与自身相关吗?