'As a workaround for AIRFLOW-277, this method overrides Flask-Admin\'s ModelView.action_delete().
TODO: this method should be removed once the below bug is fixed on Flask-Admin side.
https://github.com/flask-admin/flask-admin/issues/1226'

@action('delete', lazy_gettext('Delete'), lazy_gettext('Are    you    sure    you    want    to    delete    selected    records?'))
def action_delete(self, ids):

    if ('sqlite' in conf.get('core', 'sql_alchemy_conn')):
        self.delete_task_instances(ids)
    else:
        super(TaskInstanceModelView, self).action_delete(ids)
