Multiple Delete in Admin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from django.contrib.admin.decorators import admin_action

# inside CommentManager in django.contrib.comments.models


    @admin_action( name='Delete selected posts' )
    def multi_delete( self, id_list ):
        res = ""
        for id in id_list:
            obj = self.get( pk=id )
            res += repr( obj )
            obj.delete()
            res += "<br/>\n"
        return "Deleted %s" % res

More like this

  1. MintCache by gfranxman 6 years, 1 month ago
  2. Add delete buttons to admin changelist by kylefox 5 years, 12 months ago
  3. Hackish Way to Execute on manage.py Action by joshua 6 years, 2 months ago
  4. Extended cacheable callables and properties by gsakkis 2 years, 11 months ago
  5. Redirect with change list with filters intact with admin actions by AndrewIngram 3 years, 10 months ago

Comments

(Forgotten your password?)