@action('delete', lazy_gettext('Delete'), lazy_gettext('Are you sure you want to delete selected records?'))
def action_delete(self, ids):
    try:
        count = 0
        all_ids = [self.object_id_converter(pk) for pk in ids]
        for obj in self.get_query().in_bulk(all_ids).values():
            count += self.delete_model(obj)
        flash(ngettext('Record was successfully deleted.', '%(count)s records were successfully deleted.', count, count=count))
    except Exception as ex:
        if (not self.handle_view_exception(ex)):
            flash(gettext('Failed to delete records. %(error)s', error=str(ex)), 'error')
@action('delete', lazy_gettext('Delete'), lazy_gettext('Are you sure you want to delete selected records?'))
def action_delete(self, ids):
    try:
        count = 0
        all_ids = [self.object_id_converter(pk) for pk in ids]
        for obj in self.get_query().in_bulk(all_ids).values():
            count += self.delete_model(obj)
        flash(ngettext('Record was successfully deleted.', '%(count)s records were successfully deleted.', count, count=count))
    except Exception as ex:
        if (not self.handle_view_exception(ex)):
            flash(gettext('Failed to delete records. %(error)s', error=str(ex)), 'error')