diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-16 01:57:25 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-16 01:57:25 +0000 |
| commit | e2409750f8a551d3094e44f9795d94188a45c606 (patch) | |
| tree | 01c57003a2a92ec703f1472719abbb2aea8517b8 /docs | |
| parent | 1de4bf0b66d5c59f3b46767f9506ee2a78b64540 (diff) | |
Fixed #3703 -- Added pk property to models. Thanks, Collin Grady and jeromie@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6346 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/model-api.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt index 1f0bb60285..adb9cfceb1 100644 --- a/docs/model-api.txt +++ b/docs/model-api.txt @@ -1284,6 +1284,17 @@ won't add the automatic ``id`` column. Each model requires exactly one field to have ``primary_key=True``. +The ``pk`` property +------------------- +**New in Django development version** + +Regardless of whether you define a primary key field yourself, or let Django +supply one for you, each model will have a property called ``pk``. It behaves +like a normal attribute on the model, but is actually an alias for whichever +attribute is the primary key field for the model. You can read and set this +value, just as you would for any other attribute, and it will update the +correct field in the model. + Admin options ============= |
