summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-10-20 13:51:21 -0400
committerTim Graham <timograham@gmail.com>2017-10-20 14:52:48 -0400
commit1a82fc245eb8ac4b131ec02a6ac3e112deb8d5a6 (patch)
tree1753718afc33ed23cafbda68941f18e7c24a3d90 /docs/ref
parenteb9b56c5b60215a683c80e68f08ae6fca0ec24ef (diff)
Fixed #28613 -- Doc'd the return value for GenericForeignKey when the related object is deleted.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/contenttypes.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt
index e5635ef59e..bc73308b69 100644
--- a/docs/ref/contrib/contenttypes.txt
+++ b/docs/ref/contrib/contenttypes.txt
@@ -335,6 +335,13 @@ creating a ``TaggedItem``::
>>> t.content_object
<User: Guido>
+If the related object is deleted, the ``content_type`` and ``object_id`` fields
+remain set to their original values and the ``GenericForeignKey`` returns
+``None``::
+
+ >>> guido.delete()
+ >>> t.content_object # returns None
+
Due to the way :class:`~django.contrib.contenttypes.fields.GenericForeignKey`
is implemented, you cannot use such fields directly with filters (``filter()``
and ``exclude()``, for example) via the database API. Because a