summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorJames Bennett <ubernostrum@gmail.com>2008-08-31 10:13:32 +0000
committerJames Bennett <ubernostrum@gmail.com>2008-08-31 10:13:32 +0000
commit78ca7a6c073e07f311e37b45d8dfe7fce7465e06 (patch)
treea7bf04f86bb78301f7a0dc9a4ecd8faf2d2a92db /docs/ref
parent27f9b96fa0b57857cb660e56c66e3ede5dee8c18 (diff)
Fixed #8533: restored model inheritance docs, and updated one-to-one docs to match
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8757 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/fields.txt32
-rw-r--r--docs/ref/models/options.txt10
2 files changed, 36 insertions, 6 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 909bfeff1f..bf5d7b30cd 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -811,7 +811,10 @@ define the details of how the relation works.
The name to use for the relation from the related object back to this one.
See the :ref:`related objects documentation <backwards-related-objects>` for
- a full explanation and example.
+ a full explanation and example. Note that you must set this value
+ when defining relations on :ref:`abstract models
+ <abstract-base-classes>`; and when you do so
+ :ref:`some special syntax <abstract-related-name>` is available.
.. attribute:: ForeignKey.to_field
@@ -883,8 +886,27 @@ that control how the relationship functions.
``OneToOneField``
-----------------
-.. class:: OneToOneField(othermodel, [**options])
+.. class:: OneToOneField(othermodel, [parent_link=False, **options])
-The semantics of one-to-one relationships will be changing soon, so we don't
-recommend you use them. If that doesn't scare you away, however,
-:class:`OneToOneField` takes the same options that :class:`ForeignKey` does.
+A one-to-one relationship. Conceptually, this is similar to a
+:class:`ForeignKey` with :attr:`unique=True <Field.unique>`, but the
+"reverse" side of the relation will directly return a single object.
+
+This is most useful as the primary key of a model which "extends"
+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.
+
+Additionally, ``OneToOneField`` accepts all of the extra arguments
+accepted by :class:`ForeignKey`, plus one extra argument:
+
+.. 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
+ link back to the parent class, rather than the extra
+ ``OneToOneField`` which would normally be implicitly created by
+ subclassing.
diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt
index 34ec7a19ed..745e8ceb4f 100644
--- a/docs/ref/models/options.txt
+++ b/docs/ref/models/options.txt
@@ -4,13 +4,21 @@
Model ``Meta`` options
======================
-This document explains all the possible :ref:`metadata options <meta-options>` that you can give your model in its internal ``class Meta``.
+This document explains all the possible :ref:`metadata options <meta-options>` that you can give your model in its internal
+``class Meta``.
Available ``Meta`` options
==========================
.. currentmodule:: django.db.models
+``abstract``
+------------
+
+.. attribute:: Options.abstract
+
+If ``True``, this model will be an :ref:`abstract base class <abstract-base-classes>`.
+
``db_table``
------------