Opened 10 years ago

Closed 5 years ago

#8565 closed Cleanup/optimization (wontfix)

Comments should use object_id instead of object_pk

Reported by: Peter Baumgartner Owned by: nobody
Component: contrib.comments Version: master
Severity: Normal Keywords: comments generic object_pk object_id
Cc: pete@… Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


django.contrib.comments.models.BaseCommentAbstractModel uses object_pk to create a generic relation

I may be missing something, but straying from the expected and documented default of object_id seems to only create extra confusion. I noticed this when trying to add a GenericTabularInline

Change History (6)

comment:1 Changed 10 years ago by Ramiro Morales

See also #8554

comment:2 Changed 10 years ago by Jacob

Resolution: duplicate
Status: newclosed

Dup of #8554.

comment:3 Changed 6 years ago by anonymous

Easy pickings: unset
Resolution: duplicate
Severity: Normal
Status: closedreopened
Type: Uncategorized
UI/UX: unset

I don't see how this is a duplicate of 8554, which has to do with casting the output of object_pk to text. The issue here is the use of "object_pk" instead of "object_id" has the field name. This non-standard field name requires anyone who extends it and uses GenericRelation back to use object_id_field="object_pk". This isn't documented anywhere either.

comment:4 Changed 6 years ago by anonymous

Type: UncategorizedBug

comment:5 Changed 6 years ago by Łukasz Rekucki

Triage Stage: UnreviewedSomeday/Maybe
Type: BugCleanup/optimization

This isn't documented anywhere either.

How about ?

I don't really see an issue here. Sure, it would be better if the original author used the default name, but having a different name doesn't break anything. Changing this would mean, *every* project using contrib.comments would have to migrate or monkey patch, so I don't think this is worth the trouble. Maybe in 2.0 ?

comment:6 Changed 5 years ago by Aymeric Augustin

Resolution: wontfix
Status: reopenedclosed

This is a bit annoying, but changing the name doesn't seem worth it at this point.

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