mirror of https://github.com/django/django.git
[1.11.x] Fixed #28003 -- Doc'd what an auto-created OneToOneField parent_link looks like.
Backport of 0ad7e8f71f
from master
This commit is contained in:
parent
0a8dbd9c2f
commit
f0bf4bd79c
|
@ -1082,6 +1082,18 @@ created directly as a ``Place`` object or was the parent of some other class),
|
||||||
referring to ``p.restaurant`` would raise a ``Restaurant.DoesNotExist``
|
referring to ``p.restaurant`` would raise a ``Restaurant.DoesNotExist``
|
||||||
exception.
|
exception.
|
||||||
|
|
||||||
|
The automatically-created :class:`~django.db.models.OneToOneField` on
|
||||||
|
``Restaurant`` that links it to ``Place`` looks like this::
|
||||||
|
|
||||||
|
place_ptr = models.OneToOneField(
|
||||||
|
Place, on_delete=models.CASCADE,
|
||||||
|
parent_link=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
You can override that field by declaring your own
|
||||||
|
:class:`~django.db.models.OneToOneField` with :attr:`parent_link=True
|
||||||
|
<django.db.models.OneToOneField.parent_link>` on ``Restaurant``.
|
||||||
|
|
||||||
.. _meta-and-multi-table-inheritance:
|
.. _meta-and-multi-table-inheritance:
|
||||||
|
|
||||||
``Meta`` and multi-table inheritance
|
``Meta`` and multi-table inheritance
|
||||||
|
|
Loading…
Reference in New Issue