diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-06-07 18:24:27 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-06-07 18:24:27 +0000 |
| commit | 21acccbca25948ba04be05a5d2750d88ffa2fa37 (patch) | |
| tree | ad701c33f3edc8aef1310e34dab3097cf401e7c8 /docs | |
| parent | f6491bf98402a8896ee1d3f5c7912e588b57a7b8 (diff) | |
Fixed #4214: added a bit of explicit info on updating FK fields to db-api.txt. Thanks, david@kazserve.org.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5437 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/db-api.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt index dda3377885..8c93cb78d4 100644 --- a/docs/db-api.txt +++ b/docs/db-api.txt @@ -134,6 +134,15 @@ the database until you explicitly call ``save()``. The ``save()`` method has no return value. +Updating ``ForeignKey`` fields works exactly the same way; simply assign an +object of the right type to the field in question:: + + joe = Author.objects.create(name="Joe") + entry.author = joe + entry.save() + +Django will complain if you try to assign an object of the wrong type. + How Django knows to UPDATE vs. INSERT ------------------------------------- |
