#10889: ModelAdmin calls .log_deletion after deletion, causing invalid object_id
-------------------------------------------+--------------------------------
Reporter: jdunck | Owner: nobody
Status: new | Milestone: 1.1
Component: django.contrib.admin | Version: 1.1-beta-1
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by jdunck):
ramiro,
Alex and I discussed that-- unfortunately, I don't think it can be
easily fixed, because .log_deletion is a public method of ModelAdmin,
which may have been subclassed. log_deletion takes the object being
deleted as a parameter, not just the object PK, so the only way I can see
reversing this would be some hackery like:
{{{
old_obj_pk = obj.pk
obj.delete()
new_obj_pk = obj.pk
try:
obj.pk = old_obj_pk
self.log_deletion(...,obj,...)
finally:
obj.pk = new_obj_pk
}}}
This strikes me as more than a little gross.
Opinions?
--
Ticket URL: <http://code.djangoproject.com/ticket/10889#comment:4>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---