Opened 19 years ago
Closed 18 years ago
#1196 closed defect (fixed)
[patch] AttributeError when deleting related object in admin, if related object has custom primary key
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | major | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a model like so:
class MyData(meta.Model):
....
class MyOtherData(meta.Model):
my_primary = meta.ForeignKey(MyData, primary_key=True, raw_id_admin=True)
When I use the delete button in admin to remove a MyData object, I get the following error:
AttributeError: 'MyOtherData' object has no attribute 'id'
The _get_deleted_objects() method is looking for the id field rather than using the model's pk.
Attachments (1)
Change History (5)
by , 19 years ago
Attachment: | atterror.diff added |
---|
comment:1 by , 19 years ago
Version: | → SVN |
---|
comment:2 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 18 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:4 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
If you're going to reopen a ticket, please provide details about what is going wrong. We need to know the Django version you are using (subversion changeset number if you are using a subversion checkout) and an example (as small as possible) of what is failing.
Reclosing until the extra information is provided, because in the current state, we can do nothing about this.
Patch for _get_deleted_objects method