Author: jacob Date: 2007-06-07 13:24:27 -0500 (Thu, 07 Jun 2007) New Revision: 5437
Modified: django/trunk/docs/db-api.txt Log: Fixed #4214: added a bit of explicit info on updating FK fields to db-api.txt. Thanks, [EMAIL PROTECTED] Modified: django/trunk/docs/db-api.txt =================================================================== --- django/trunk/docs/db-api.txt 2007-06-07 18:18:44 UTC (rev 5436) +++ django/trunk/docs/db-api.txt 2007-06-07 18:24:27 UTC (rev 5437) @@ -134,6 +134,15 @@ 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 ------------------------------------- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
