class SecurityGroup(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
subgroups = models.ManyToManyField('self', related_name='origin')
def __str__(self):
return self.nameAnd here is the problem:
>>> x = SecurityGroup(name='name', description='description')
>>> x.save()
>>> x.origin()
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'SecurityGroup' object has no attribute 'origin'There also no x.securitygroup_set. Is this a bug?