diff --git a/caravel/models.py b/caravel/models.py index 46006e7459115..e359044faddef 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -83,11 +83,11 @@ def changed_by_fk(cls): # noqa Integer, ForeignKey('ab_user.id'), default=cls.get_user_id, onupdate=cls.get_user_id, nullable=True) - @renders('created_by') + @renders('created_on') def creator(self): # noqa return '{}'.format(self.created_by or '') - @renders('changed_by') + @property def changed_by_(self): return '{}'.format(self.changed_by or '') @@ -168,7 +168,7 @@ def __repr__(self): def datasource(self): return self.table or self.druid_datasource - @property + @renders('datasource_name') def datasource_link(self): if self.table: return self.table.link @@ -570,7 +570,7 @@ def html(self): def name(self): return self.table_name - @property + @renders('table_name') def table_link(self): return '{obj.table_name}'.format(obj=self) @@ -1071,7 +1071,7 @@ def full_name(self): def __repr__(self): return self.datasource_name - @property + @renders('datasource_name') def datasource_link(self): url = "/caravel/explore/{obj.type}/{obj.id}/".format(obj=self) return '{obj.datasource_name}'.format( diff --git a/caravel/views.py b/caravel/views.py index fcdecd5f70a9a..dbc1a35b8962b 100644 --- a/caravel/views.py +++ b/caravel/views.py @@ -409,6 +409,8 @@ class TableModelView(CaravelModelView, DeleteMixin): # noqa list_columns = [ 'table_link', 'database', 'sql_link', 'is_featured', 'changed_by_', 'changed_on_'] + order_columns = [ + 'table_link', 'database', 'sql_link', 'is_featured', 'changed_on_'] add_columns = [ 'table_name', 'database', 'schema', 'default_endpoint', 'offset', 'cache_timeout'] @@ -666,7 +668,9 @@ class LogModelView(CaravelModelView): class DruidDatasourceModelView(CaravelModelView, DeleteMixin): # noqa datamodel = SQLAInterface(models.DruidDatasource) list_columns = [ - 'datasource_link', 'cluster', 'changed_by_', 'modified', 'offset'] + 'datasource_link', 'cluster', 'changed_by_', 'changed_on_', 'offset'] + order_columns = [ + 'datasource_link', 'changed_on_', 'offset'] related_views = [DruidColumnInlineView, DruidMetricInlineView] edit_columns = [ 'datasource_name', 'cluster', 'description', 'owner', @@ -682,7 +686,7 @@ class DruidDatasourceModelView(CaravelModelView, DeleteMixin): # noqa "https://daringfireball.net/projects/markdown/'>markdown"), } label_columns = { - 'datasource_name': _("Data Source"), + 'datasource_link': _("Data Source"), 'cluster': _("Cluster"), 'description': _("Description"), 'owner': _("Owner"),