Adding list of table names to show Dashboard view (#648)

This commit is contained in:
Maxime Beauchemin
2016-06-21 09:41:48 -07:00
committed by GitHub
parent ff44e46d7b
commit 7e8053abef
2 changed files with 6 additions and 0 deletions

View File

@@ -294,6 +294,10 @@ class Dashboard(Model, AuditMixinNullable):
def __repr__(self):
return self.dashboard_title
@property
def table_names(self):
return ", ".join({"{}".format(s.datasource) for s in self.slices})
@property
def url(self):
return "/caravel/dashboard/{}/".format(self.slug or self.id)

View File

@@ -509,6 +509,7 @@ class DashboardModelView(CaravelModelView, DeleteMixin): # noqa
edit_columns = [
'dashboard_title', 'slug', 'slices', 'owners', 'position_json', 'css',
'json_metadata']
show_columns = edit_columns + ['table_names']
add_columns = edit_columns
base_order = ('changed_on', 'desc')
description_columns = {
@@ -541,6 +542,7 @@ class DashboardModelView(CaravelModelView, DeleteMixin): # noqa
'position_json': _("Position JSON"),
'css': _("CSS"),
'json_metadata': _("JSON Metadata"),
'table_names': _("Underlying Tables"),
}
def pre_add(self, obj):