mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Fixed #5537 -- document trailing '+' on related_name for supressing backward relation.
Thanks to dcramer for the report, and Russ for pointing out the workaround. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14049 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5b155e2a87
commit
fa3335fa9f
@ -925,6 +925,15 @@ define the details of how the relation works.
|
|||||||
<abstract-base-classes>`; and when you do so
|
<abstract-base-classes>`; and when you do so
|
||||||
:ref:`some special syntax <abstract-related-name>` is available.
|
: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
|
.. attribute:: ForeignKey.to_field
|
||||||
|
|
||||||
The field on the related object that the relation is to. By default, Django
|
The field on the related object that the relation is to. By default, Django
|
||||||
|
Loading…
Reference in New Issue
Block a user