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
- MPTTModelAdmin by anentropic 2 years, 6 months ago
- Hackish Way to Execute on manage.py Action by joshua 5 years, 2 months ago
- syncdata command by graham 3 years, 9 months ago
- Export Related as JSON Admin Action by johnboxall 2 years, 10 months ago
- Dynamically create Django admin actions by pantsman 2 years, 5 months ago
Comments