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
This commit is contained in:
Jacob Kaplan-Moss 2007-06-07 18:24:27 +00:00
parent f6491bf984
commit 21acccbca2
1 changed files with 9 additions and 0 deletions

View File

@ -134,6 +134,15 @@ the database until you explicitly call ``save()``.
The ``save()`` method has no return value. 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 How Django knows to UPDATE vs. INSERT
------------------------------------- -------------------------------------