Opened 16 years ago

Closed 14 years ago

Last modified 14 years ago

#11047 closed (fixed)

Clarification of contenttypes docs

Reported by: psmith Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords: contenttypes genericrelation genericforeignkey
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found the paragraph about using a GenericForeignKey in a GenericRelation to be somewhat confusing at first read, and the example line of code explicitly sets the content_type_field, even though the example of Comment uses a default value for content_type_field.

Attachments (2)

doc_patch_against_10706.diff (1.5 KB ) - added by psmith 16 years ago.
Patch against docs/ref/contenttypes.txt
11047.diff (1.8 KB ) - added by Tim Graham 15 years ago.
further clarification based on existing patch

Download all attachments as: .zip

Change History (6)

by psmith, 16 years ago

Patch against docs/ref/contenttypes.txt

comment:1 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

by Tim Graham, 15 years ago

Attachment: 11047.diff added

further clarification based on existing patch

comment:2 by Tim Graham, 15 years ago

Triage Stage: AcceptedReady for checkin

I tried to clarify the wording a bit further, but I'll leave it up to the committer to decide which version he or she thinks is most clear. Here's the final text I came up with:

Note that if the model in a GenericRelation uses a non-default value for
ct_field or fk_field in its GenericForeignKey (e.g. the
django.contrib.comments app uses ct_field="object_pk"), you'll need to 
set content_type_field and/or object_id_field in the GenericRelation to
match the ct_field and fk_field, respectively, in the GenericForeignKey

comment:3 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [13554]) Fixed #11047 -- Clarified the explanation of arguments to GenericForeignKey. Thanks to psmith and timo for their work on the patch.

comment:4 by Russell Keith-Magee, 14 years ago

(In [13561]) [1.2.X] Fixed #11047 -- Clarified the explanation of arguments to GenericForeignKey. Thanks to psmith and timo for their work on the patch.

Backport of r13554 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top