Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13554 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 103f7f83eb5f46bcfa2473dadc38a19f59832565 1 parent 50e3aa0
Russell Keith-Magee authored August 07, 2010

Showing 1 changed file with 13 additions and 9 deletions. Show diff stats Hide diff stats

  1. 22  docs/ref/contrib/contenttypes.txt
22  docs/ref/contrib/contenttypes.txt
@@ -324,15 +324,19 @@ same types of lookups manually::
324 324
     ...                           object_id=b.id)
325 325
     [<TaggedItem: django>, <TaggedItem: python>]
326 326
 
327  
-Note that if the model with a :class:`~django.contrib.contenttypes.generic.GenericForeignKey`
328  
-that you're referring to uses a non-default value for ``ct_field`` or ``fk_field``
329  
-(e.g. the :mod:`django.contrib.comments` app uses ``ct_field="object_pk"``),
330  
-you'll need to pass ``content_type_field`` and ``object_id_field`` to
331  
-:class:`~django.contrib.contenttypes.generic.GenericRelation`.::
332  
-
333  
-	comments = generic.GenericRelation(Comment, content_type_field="content_type", object_id_field="object_pk")
334  
-
335  
-Note that if you delete an object that has a
  327
+Note that if the model in a
  328
+:class:`~django.contrib.contenttypes.generic.GenericRelation` uses a
  329
+non-default value for ``ct_field`` or ``fk_field`` in its
  330
+:class:`~django.contrib.contenttypes.generic.GenericForeignKey` (e.g. the
  331
+:mod:`django.contrib.comments` app uses ``ct_field="object_pk"``),
  332
+you'll need to set ``content_type_field`` and/or ``object_id_field`` in
  333
+the :class:`~django.contrib.contenttypes.generic.GenericRelation` to
  334
+match the ``ct_field`` and ``fk_field``, respectively, in the
  335
+:class:`~django.contrib.contenttypes.generic.GenericForeignKey`::
  336
+
  337
+	comments = generic.GenericRelation(Comment, object_id_field="object_pk")
  338
+
  339
+Note also, that if you delete an object that has a
336 340
 :class:`~django.contrib.contenttypes.generic.GenericRelation`, any objects
337 341
 which have a :class:`~django.contrib.contenttypes.generic.GenericForeignKey`
338 342
 pointing at it will be deleted as well. In the example above, this means that

0 notes on commit 103f7f8

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