#22778: Specify default value for a Model's RelatedFields related_name.
----------------------------------------------+--------------------
Reporter: renaud.parent@… | Owner: nobody
Type: New feature | Status: new
Component: Database layer (models, ORM) | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
It would be nice to be able to define a specific default "model-based"
related_name value for RelatedField fields. Currently it is
<model_name>_set, and can be overriden when defining one field.
E.g.
{{{
class Author(models.Model):
# ...
pass
class Editor(models.Model):
# ...
pass
class Book(models.Model):
editor = models.ForeignKey(Editor, related_name="books")
authors = models.ManyToManyField(Author, related_name="books")
}}}
It would be nice to be able to define the model Book in some way that
would look like this :
{{{
class Book(models.Model):
class Meta:
default_related_name = "books"
editor = models.ForeignKey(Editor)
authors = models.ManyToManyField(Author)
}}}
See discussion at http://stackoverflow.com/questions/24062280/django-is-
it-possible-to-define-a-class-related-name-for-all-relational-fields
--
Ticket URL: <https://code.djangoproject.com/ticket/22778>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.9cd869b1b6b3d4b977e26b54e1fa7b58%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.