Ticket #11047: doc_patch_against_10706.diff

File doc_patch_against_10706.diff, 1.5 KB (added by psmith, 16 years ago)

Patch against docs/ref/contenttypes.txt

  • docs/ref/contrib/contenttypes.txt

     
    324324    ...                           object_id=b.id)
    325325    [<TaggedItem: django>, <TaggedItem: python>]
    326326
    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`.::
     327Note that if the model you're referring to is a
     328:class:`~django.contrib.contenttypes.generic.GenericForeignKey` that
     329uses a non-default value for ``ct_field`` or ``fk_field`` (e.g. the
     330:mod:`django.contrib.comments` app uses ``ct_field="object_pk"``),
     331you'll need to set ``content_type_field`` and ``object_id_field`` of
     332the :class:`~django.contrib.contenttypes.generic.GenericRelation` to
     333match the ``ct_field`` and ``fk_field``, respectively, of the
     334referred-to model::
    332335
    333         comments = generic.GenericRelation(Comment, content_type_field="content_type", object_id_field="object_pk")
     336        comments = generic.GenericRelation(Comment, object_id_field="object_pk")
    334337
    335338Note that if you delete an object that has a
    336339:class:`~django.contrib.contenttypes.generic.GenericRelation`, any objects
Back to Top