Opened 4 years ago
Last modified 3 years ago
#32137 closed Cleanup/optimization
Change message describing the deletion of inline objects in admin has no id available — at Version 1
Reported by: | Vlada Macek | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Richard Laager | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Sometimes the developer wishes the id
to be a part of the Model.__str__
.
Such model could of course be as inline in other model admin.
When such inline object is deleted, the save_related()
of the formset deletes it just before the first call of construct_change_message()
in https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1586 chimes in.
At that moment, the id
is None and "None" makes it to the "Deleted ..." LogEntry.change_message
for the formset.