id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 18021 "An attribute for related_name is not created for many-to-many relationships on ""self""" dmitry.blotsky@… nobody "When a ManyToMany relationship named ""a1"" is specified on ""self"" with a related_name=""a2"", an attribute named ""a2"" is NOT created on the object and reverse relationships are updated in related objects' ""a1"" attribute. Code to demonstrate: {{{#!python class Container(models.Model): contains = models.ManyToManyField(""self"", related_name=""contained_in"") (Interactive Console) >>> a, b = Container(), Container() >>> a.save() >>> b.save() >>> a.contains.add(b) >>> a.contains.all() [b] >>> b.contains.all() [a] >>> b.contained_in Traceback (most recent call last): File """", line 1, in AttributeError: 'Container' object has no attribute 'contained_in' }}}" Bug closed Database layer (models, ORM) 1.3 Normal invalid many-to-many many to many reverse lookup relationship related_name related name recursive self Unreviewed 0 0 0 0 0 0