Skip to content

Commit

Permalink
Merge pull request apache#1609 from sekikn/AIRFLOW-252
Browse files Browse the repository at this point in the history
  • Loading branch information
criccomini committed Jun 21, 2016
2 parents 3ffa656 + 79d3be5 commit 072fa8e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from flask_admin import BaseView, expose, AdminIndexView
from flask_admin.contrib.sqla import ModelView
from flask_admin.actions import action
from flask_admin.tools import iterdecode
from flask_login import flash
from flask._compat import PY2

Expand Down Expand Up @@ -2097,6 +2098,17 @@ def set_task_instance_state(self, ids, target_state, session=None):
raise Exception("Ooops")
flash('Failed to set state', 'error')

def get_one(self, id):
"""
As a workaround for AIRFLOW-252, this method overrides Flask-Admin's ModelView.get_one().
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
"""
task_id, dag_id, execution_date = iterdecode(id)
execution_date = dateutil.parser.parse(execution_date)
return self.session.query(self.model).get((task_id, dag_id, execution_date))


class ConnectionModelView(wwwutils.SuperUserMixin, AirflowModelView):
create_template = 'airflow/conn_create.html'
Expand Down

0 comments on commit 072fa8e

Please sign in to comment.