From 87d0a3384cc263fe0df749a28e2fbc1e1240f043 Mon Sep 17 00:00:00 2001 From: Renaud Parent Date: Fri, 6 Jun 2014 16:16:17 +0000 Subject: Fixed #22778 -- Added a model Meta option to define default_related_name. Thanks jorgecarleitao and mmardini for reviews. --- docs/ref/models/options.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt index 75b6de8040..6cb2e34bd9 100644 --- a/docs/ref/models/options.txt +++ b/docs/ref/models/options.txt @@ -95,6 +95,23 @@ Django quotes column and table names behind the scenes. setting, if set. If the backend doesn't support tablespaces, this option is ignored. +``default_related_name`` +------------------------ + +.. attribute:: Options.default_related_name + +.. versionadded:: 1.8 + + The name that will be used by default for the relation from a related object + back to this one. The default is ``_set``. + + As the reverse name for a field should be unique, be careful if you intend + to subclass your model. To work around name collisions, part of the name + should contain ``'%(app_label)s'`` and ``'%(model_name)s'``, which are + replaced respectively by the name of the application the model is in, + and the name of the model, both lowercased. See the paragraph on + :ref:`related names for abstract models `. + ``get_latest_by`` ----------------- -- cgit v1.3