#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)
Change History (6)
by , 17 years ago
| Attachment: | doc_patch_against_10706.diff added |
|---|
comment:1 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 16 years ago
| Triage Stage: | Accepted → 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 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:4 by , 15 years ago
Note:
See TracTickets
for help on using tickets.
Patch against docs/ref/contenttypes.txt