Kaydet (Commit) 1a82fc24 authored tarafından Tim Graham's avatar Tim Graham

Fixed #28613 -- Doc'd the return value for GenericForeignKey when the related object is deleted.

üst eb9b56c5
...@@ -335,6 +335,13 @@ creating a ``TaggedItem``:: ...@@ -335,6 +335,13 @@ creating a ``TaggedItem``::
>>> t.content_object >>> t.content_object
<User: Guido> <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` Due to the way :class:`~django.contrib.contenttypes.fields.GenericForeignKey`
is implemented, you cannot use such fields directly with filters (``filter()`` is implemented, you cannot use such fields directly with filters (``filter()``
and ``exclude()``, for example) via the database API. Because a and ``exclude()``, for example) via the database API. Because a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment