When deleting from the admin interface, the delete is actually on the entire
QuerySet rather than on the object level. So if you need to perform some
object level modification on the delete action of the admin interface, you
can remove the default 'delete_selected' action, and go a custom delete
action. Like:

class SomeModelAdmin(admin.ModelAdmin):
actions = ['custom_delete']
 def custom_delete(self, request, queryset):
         for object in queryset:
perform_some_action(object)
object.delete()
custom_delete.short_description = "Delete selected items"

def get_actions(self, request):
actions = super(SomeModelAdmin, self).get_actions(request)
del actions['delete_selected']
return actions

Thanks,
Subhranath Chunder.

On Fri, Jan 7, 2011 at 8:52 PM, galago <prog...@gmail.com> wrote:

> I made what I wanted in
> def log_deletion(self, request, object, object_repr):
>
> It's not elegant, but in Django 1.3 there is a delete_model() function:)
> But now I'm using 1.2.4 :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to