#8738 closed (invalid)
Compatability with contenttypes
Reported by: | mattrussell | Owned by: | nobody |
---|---|---|---|
Component: | contrib.comments | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Just tried upgrading to latest, and get an exception:
FieldError - "Cannot resolve keyword 'object_id' into field"
Exception Location: /usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py in setup_joins, line 1248
This is running off trunk (r8726)
I notice that comments have an object_pk field, should that be object_id? Or is there more needed than the SQL provided
in the upgrade sql snippet?
This is when using comments with django.contrib.contenttypes.generic.GenericRelation and friends.
Change History (5)
follow-up: 2 comment:1 by , 16 years ago
comment:2 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Replying to mattrussell:
I've managed to work around this by assigning my generic relations like this:
That's not a work around; that's correct code.
comment:3 by , 16 years ago
The point is that contrib.comments chooses to use "object_pk" in place of "object_id", which is the default for contrib.contenttypes.generic, meaning you always have to give the object_id_field parameter explicitly. Not a bug, really, but annoying for no apparent reason.
comment:4 by , 16 years ago
Agree, annoying for no apparently reason. Made worse by the documentation not mentioning that object_id_field
is an argument to GenericRelation
or that the comments app uses a field name that is different to the default. I think this ticket should be re-opened with intent to fix with an addition to the documentation.
I've managed to work around this by assigning my generic relations like this: