Reputation: 424
I would like to display the delete_selected action in the drop-down list in the admin screen as the last option just for one model.
Upvotes: 1
Views: 163
Reputation: 424
I managed to make it work like this. Would be there a nicer way?
class MyModelAdmin(admin.ModelAdmin):
actions = ['soft_delete_selected', 'soft_undelete_selected']
def get_actions(self, request):
actions = super().get_actions(request)
action = actions['delete_selected']
del actions['delete_selected']
actions['delete_selected'] = action
return actions
Upvotes: 2