Code

Opened 5 years ago

Closed 4 years ago

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

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by psmith

Patch against docs/ref/contenttypes.txt

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 4 years ago by timo

further clarification based on existing patch

comment:2 Changed 4 years ago by timo

  • Triage Stage changed from Accepted to Ready 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 4 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 4 years ago by russellm

(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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.