Loading docs/topics/db/queries.txt +2 −1 Original line number Diff line number Diff line Loading @@ -100,7 +100,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) Loading Loading
docs/topics/db/queries.txt +2 −1 Original line number Diff line number Diff line Loading @@ -100,7 +100,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) Loading