summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-08 09:49:17 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-08 09:49:17 +0000
commitaccc20d799b4a1e584688d2a5b9db555058ab7a9 (patch)
treefc1cec2de838e917439ec1eb8dca59f2ced26ac0 /docs
parent55cd02567099767ff9e48a8be24157db6a934ba0 (diff)
queryset-refactor: Fixed up OneToOneFields (mostly).
They now share as much code as possible with ForeignKeys, but behave more or less as they did before (the backwards incompatible change is that they are no longer automatically primary keys -- so more than one per model is permitted). The documentation still uses an example that is better suited to model inheritance, but that will change in due course. Also, the admin interface still shows them as read-only fields, which is probably wrong now, but that can change on newforms-admin after this branch is merged into trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7096 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/model-api.txt11
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 3f908ec158..6b8310176b 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -979,9 +979,6 @@ the relationship should work. All are optional:
One-to-one relationships
~~~~~~~~~~~~~~~~~~~~~~~~
-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, keep reading.
-
To define a one-to-one relationship, use ``OneToOneField``. You use it just
like any other ``Field`` type: by including it as a class attribute of your
model.
@@ -1003,9 +1000,11 @@ As with ``ForeignKey``, a relationship to self can be defined by using the
string ``"self"`` instead of the model name; references to as-yet undefined
models can be made by using a string containing the model name.
-This ``OneToOneField`` will actually replace the primary key ``id`` field
-(since one-to-one relations share the same primary key), and will be displayed
-as a read-only field when you edit an object in the admin interface:
+**New in Django development version:** ``OneToOneField`` classes used to
+automatically become the primary key on a model. This is no longer true,
+although you can manually pass in the ``primary_key`` attribute if you like.
+Thus, it's now possible to have multilpe fields of type ``OneToOneField`` on a
+single model.
See the `One-to-one relationship model example`_ for a full example.