summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2017-04-01 21:21:15 -0400
committerTim Graham <timograham@gmail.com>2017-04-01 21:22:19 -0400
commitf0bf4bd79cf40131ef591d6e8f01ce48c9454da5 (patch)
treec8800c1ec517b70f51a54c9b174146d10ba023b1
parent0a8dbd9c2f327bef462f04e3aea7e5100fcfe5af (diff)
[1.11.x] Fixed #28003 -- Doc'd what an auto-created OneToOneField parent_link looks like.
Backport of 0ad7e8f71fbf75def0e48ef59adc2d56a6244b38 from master
-rw-r--r--docs/topics/db/models.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
index 9833ff5afb..ec725b77c2 100644
--- a/docs/topics/db/models.txt
+++ b/docs/topics/db/models.txt
@@ -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``
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