Opened 8 years ago

Closed 6 years ago

Last modified 6 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: UI/UX:

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 8 years ago.
Patch against docs/ref/contenttypes.txt
11047.diff (1.8 KB) - added by Tim Graham 7 years ago.
further clarification based on existing patch

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by psmith

Patch against docs/ref/contenttypes.txt

comment:1 Changed 7 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

Changed 7 years ago by Tim Graham

Attachment: 11047.diff added

further clarification based on existing patch

comment:2 Changed 7 years ago by Tim Graham

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 Changed 6 years ago by Russell Keith-Magee

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 Changed 6 years ago by Russell Keith-Magee

(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