django/django — pull request #2785 by RenaudParent (2014-06-10 09:38:18+00:00)
Title: Fixed #22778 -- Add an option to define default related_name

Example:

from django.db import models

class Author(models.Model):
name = ...

class Editor(models.Model):
name = ...

class Book(models.Model):
editor = models.ForeignKey(Editor, related_name="books")
authors = models.ManyToManyField(Author, related_name="books")

The class Book can now be written :

class Book(models.Model):
class Meta:
default_related_name = "books"
editor = models.ForeignKey(Editor)
authors = models.ManyToManyField(Author)