'Action method to handle multiple records selected from a list view'

@expose('/action_post', methods=['POST'])
def action_post(self):

    name = request.form['action']
    pks = request.form.getlist('rowid')
    if self.appbuilder.sm.has_access(name, self.__class__.__name__):
        action = self.actions.get(name)
        items = [self.datamodel.get(pk) for pk in pks]
        return action.func(items)
    else:
        flash(as_unicode(FLAMSG_ERR_SEC_ACCESS_DENIED), 'danger')
        return redirect('.')
