From 0ad7e8f71fbf75def0e48ef59adc2d56a6244b38 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sat, 1 Apr 2017 21:21:15 -0400 Subject: [PATCH] Fixed #28003 -- Doc'd what an auto-created OneToOneField parent_link looks like. Thanks Simon Charette for the draft patch. --- docs/topics/db/models.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt index e152ea8f7b..e162c6df01 100644 --- a/docs/topics/db/models.txt +++ b/docs/topics/db/models.txt @@ -1074,6 +1074,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 +` on ``Restaurant``. + .. _meta-and-multi-table-inheritance: ``Meta`` and multi-table inheritance