0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Fixed #20183 - Clarified docs assumption that certain objects exist in database.

Thanks Tomasz Jaskowski for the patch.
This commit is contained in:
Tim Graham 2013-05-19 11:30:26 -04:00
parent a4ab0e8b86
commit 41bea033b7

View File

@ -102,7 +102,8 @@ Saving ``ForeignKey`` and ``ManyToManyField`` fields
Updating a :class:`~django.db.models.ForeignKey` field works exactly the same
way as saving a normal field -- simply assign an object of the right type to
the field in question. This example updates the ``blog`` attribute of an
``Entry`` instance ``entry``::
``Entry`` instance ``entry``, assuming appropriate instances of ``Entry`` and
``Blog`` are already saved to the database (so we can retrieve them below)::
>>> from blog.models import Entry
>>> entry = Entry.objects.get(pk=1)