What is related_name used for?

What is the related_name argument useful for on ManyToManyField and ForeignKey fields? For example, given the following code, what is the effect of related_name="maps"?

class Map(db.Model):
    members = models.ManyToManyField(User, related_name="maps",
                                     verbose_name=_('members'))

6 s
6

Leave a Comment