what is the useful for?
thanks
members = models.ManyToManyField(User, related_name='maps', verbose_name=_('members'))
what is the useful for?
thanks
members = models.ManyToManyField(User, related_name='maps', verbose_name=_('members'))
The related_name attribute specifies the name of the reverse relation from the User model back to your model.
So if you had a user object current_user, you could use current_user.maps.all() to get all instances of your (presumably) Map model.
If you don't specify a related_name, Django automatically creates one using the name of your model and the suffix _set, for instance yourmap_set.
The Django documentation has more details.
it is used as a way of referencing between tables with Foreign Key and ManyToMany fields. See Wogans post for how it is implemented