Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #11047 -- Clarified the explanation of arguments to GenericFore…

…ignKey. Thanks to psmith and timo for their work on the patch.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 103f7f83eb5f46bcfa2473dadc38a19f59832565 1 parent 50e3aa0
@freakboy3742 freakboy3742 authored
Showing with 13 additions and 9 deletions.
  1. +13 −9 docs/ref/contrib/contenttypes.txt
22 docs/ref/contrib/contenttypes.txt
@@ -324,15 +324,19 @@ same types of lookups manually::
[<TaggedItem: django>, <TaggedItem: python>]
-Note that if the model with a :class:`~django.contrib.contenttypes.generic.GenericForeignKey`
-that you're referring to uses a non-default value for ``ct_field`` or ``fk_field``
-(e.g. the :mod:`django.contrib.comments` app uses ``ct_field="object_pk"``),
-you'll need to pass ``content_type_field`` and ``object_id_field`` to
- comments = generic.GenericRelation(Comment, content_type_field="content_type", object_id_field="object_pk")
-Note that if you delete an object that has a
+Note that if the model in a
+:class:`~django.contrib.contenttypes.generic.GenericRelation` uses a
+non-default value for ``ct_field`` or ``fk_field`` in its
+:class:`~django.contrib.contenttypes.generic.GenericForeignKey` (e.g. the
+:mod:`django.contrib.comments` app uses ``ct_field="object_pk"``),
+you'll need to set ``content_type_field`` and/or ``object_id_field`` in
+the :class:`~django.contrib.contenttypes.generic.GenericRelation` to
+match the ``ct_field`` and ``fk_field``, respectively, in the
+ comments = generic.GenericRelation(Comment, object_id_field="object_pk")
+Note also, that if you delete an object that has a
:class:`~django.contrib.contenttypes.generic.GenericRelation`, any objects
which have a :class:`~django.contrib.contenttypes.generic.GenericForeignKey`
pointing at it will be deleted as well. In the example above, this means that

0 comments on commit 103f7f8

Please sign in to comment.
Something went wrong with that request. Please try again.