#32137: Change message describing the deletion of inline objects in admin has
no id
available
-------------------------------------+-------------------------------------
Reporter: Vlada Macek | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: master
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* type: Bug => Cleanup/optimization
* resolution: => needsinfo
Comment:
Replying to [comment:2 Vlada Macek]:
> I'm not entirely sure if mere shifting of `construct_change_message()` a
few lines up is safe, hence I'm not providing a patch.
Unfortunately, it's not, because `new_objects` will not exist,
`changed_objects` will not take changes into account, and we will not have
the list of `deleted_objects`. We could create a copy of `obj` before
deletion:
{{{
return self.response_add(request, new_object)
diff --git a/django/forms/models.py b/django/forms/models.py
index 5d115458a1..eb9034fb43 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -790,7 +790,7 @@ class BaseModelFormSet(BaseFormSet):
if obj.pk is None:
continue
if form in forms_to_delete:
- self.deleted_objects.append(obj)
+ self.deleted_objects.append(copy.deepcopy(obj))
self.delete_existing(obj, commit=commit)
elif form.has_changed():
self.changed_objects.append((obj, form.changed_data))
}}}
but I'm not sure it's worth complexity. Closing as `needsinfo`, but I'm be
happy to re-open if we will have a reasonable proposition.
--
Ticket URL: <https://code.djangoproject.com/ticket/32137#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.6924c20a4a956448a00799cf2ad033b7%40djangoproject.com.