Skip to content

Commit

Permalink
[1.2.X] Fixed #5537 -- document trailing '+' on related_name for supr…
Browse files Browse the repository at this point in the history
…essing backward relation.

Thanks to dcramer for the report, and Russ for pointing out the workaround.

Backport of r14049 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14050 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
DrMeers committed Oct 9, 2010
1 parent 5ff085d commit 52e7812
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/ref/models/fields.txt
Expand Up @@ -925,6 +925,15 @@ define the details of how the relation works.
<abstract-base-classes>`; and when you do so
:ref:`some special syntax <abstract-related-name>` is available.

If you wish to supress the provision of a backwards relation, you may
simply provide a ``related_name`` which ends with a '+' character.
For example::

user = models.ForeignKey(User, related_name='+')

will ensure that no backwards relation to this model is provided on the
``User`` model.

.. attribute:: ForeignKey.to_field

The field on the related object that the relation is to. By default, Django
Expand Down

0 comments on commit 52e7812

Please sign in to comment.