Hi,
according to this
topic<http://stackoverflow.com/questions/1565812/the-default-delete-selected-admin-action-in-django>
the
only way to let the admin call delete() on every model using the
delete_selected admin action is to copy the function, delete the
queryset.delete()-method, add a obj.delete() in the loop, change the
template path, copy the template and change the action name in it.
In addition, actions=[my_own_delete_selected] in the ModelAdmin class
doesn't do the job, you must overwrite the get_actions method. That's much
effort for such a simple task, especially because overwriting the delete()
method is common as far as I know.
We could introduce a new admin option, let's say
"ModelAdmin.delete_explicit" to do the job:
in django/contrib/actions/admin.py:45 (Django 1.3)
for obj in queryset:
obj_display = force_unicode(obj)
modeladmin.log_deletion(request, obj, obj_display)
queryset.delete()
for obj in queryset:
obj_display = force_unicode(obj)
modeladmin.log_deletion(request, obj, obj_display)
if modeladmin.delete_explicit:
obj.delete()
if not modeladmin.delete_explicit:
queryset.delete()
Letting delete_explicit default to false, the change would be backwards
compatible.
Just a draft... What do you uthink?
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-developers/-/BVaJdKtfF3gJ.
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-developers?hl=en.