[patch] AttributeError when deleting related object in admin, if related object has custom primary key
|Reported by:||oggie rob (oz.robharvey@…||Owned by:||adrian|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have a model like so:
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.
Change History (5)
Changed 10 years ago by oggie rob
comment:3 Changed 9 years ago by earnestsloan@…
- Resolution fixed deleted
- Status changed from closed to reopened