You might be able to skip the if statement by using actions.pop('delete_selected', None)