summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRenaud Parent <renaud.parent@gmail.com>2014-06-06 16:16:17 +0000
committerTim Graham <timograham@gmail.com>2014-06-18 13:53:07 -0400
commit87d0a3384cc263fe0df749a28e2fbc1e1240f043 (patch)
tree6cb2c535b6977abd626cf96fede8fcca5595300a /docs
parentde9012907063e210e97c0d65cde312ff6174d420 (diff)
Fixed #22778 -- Added a model Meta option to define default_related_name.
Thanks jorgecarleitao and mmardini for reviews.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/options.txt17
-rw-r--r--docs/releases/1.8.txt4
2 files changed, 21 insertions, 0 deletions
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 ``<model_name>_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 <abstract-related-name>`.
+
``get_latest_by``
-----------------
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 7f3b4aa6c7..32de9ba631 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -178,6 +178,10 @@ Models
* Django now logs at most 9000 queries in ``connections.queries``, in order
to prevent excessive memory usage in long-running processes in debug mode.
+* There is now a model ``Meta`` option to define a
+ :attr:`default related name <django.db.models.Options.default_related_name>`
+ for all relational fields of a model.
+
* Pickling models and querysets across different versions of Django isn't
officially supported (it may work, but there's no guarantee). An extra
variable that specifies the current Django version is now added to the