mirror of
https://github.com/django/django.git
synced 2025-08-31 15:57:45 +00:00
Fixed #8730: Incorporated (with minor changes) additions/enhancements to one-to-one docs
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8787 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
94da2b8118
commit
b085ccce6c
3 changed files with 76 additions and 28 deletions
|
@ -883,6 +883,8 @@ that control how the relationship functions.
|
|||
is not provided, Django will assume a default name based upon the names of
|
||||
the two tables being joined.
|
||||
|
||||
.. _ref-onetoone:
|
||||
|
||||
``OneToOneField``
|
||||
-----------------
|
||||
|
||||
|
@ -897,13 +899,17 @@ another model in some way; :ref:`multi-table-inheritance` is
|
|||
implemented by adding an implicit one-to-one relation from the child
|
||||
model to the parent model, for example.
|
||||
|
||||
One positional argument is required: the class to which the model will
|
||||
be related.
|
||||
One positional argument is required: the class to which the model will be
|
||||
related. This works exactly the same as it does for :class:`ForeignKey`,
|
||||
including all the options regarding :ref:`recursive <recursive-relationships>`
|
||||
and :ref:`lazy <lazy-relationships>` relationships.
|
||||
|
||||
.. _onetoone-arguments:
|
||||
|
||||
Additionally, ``OneToOneField`` accepts all of the extra arguments
|
||||
accepted by :class:`ForeignKey`, plus one extra argument:
|
||||
|
||||
.. attribute: OneToOneField.parent_link
|
||||
.. attribute:: OneToOneField.parent_link
|
||||
|
||||
When ``True`` and used in a model which inherits from another
|
||||
(concrete) model, indicates that this field should be used as the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue