Skip to content

Commit

Permalink
views: translate labels and not names (#567)
Browse files Browse the repository at this point in the history
So that we can install caravel on postgresql:
```
2016-06-03 17:58:05,386:ERROR:flask_appbuilder.base:
Add Permission on Menu Error: (psycopg2.ProgrammingError) can't adapt type '_LazyString'
[SQL: 'SELECT ab_view_menu.id AS ab_view_menu_id, ab_view_menu.name AS
ab_view_menu_name \nFROM ab_view_menu \nWHERE ab_view_menu.name = %(name_1)s \n
LIMIT %(param_1)s'] [parameters: {'param_1': 1, 'name_1': l'Sources'}]
```

Other that translating names should be a recipe for disaster if
you switch language.

Fix #558
  • Loading branch information
xrmx authored and mistercrunch committed Jun 8, 2016
1 parent 24a68f5 commit ad5507c
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ def pre_update(self, db):
"Databases",
label=_("Databases"),
icon="fa-database",
category=_("Sources"),
category="Sources",
category_label=_("Sources"),
category_icon='fa-database',)


Expand Down Expand Up @@ -368,8 +369,10 @@ def post_update(self, table):

appbuilder.add_view(
TableModelView,
__("Tables"),
category=_("Sources"),
"Tables",
label=_("Tables"),
category="Sources",
category_label=_("Sources"),
icon='fa-table',)


Expand Down Expand Up @@ -399,9 +402,11 @@ class DruidClusterModelView(CaravelModelView, DeleteMixin): # noqa
if config['DRUID_IS_ACTIVE']:
appbuilder.add_view(
DruidClusterModelView,
__("Druid Clusters"),
name="Druid Clusters",
label=_("Druid Clusters"),
icon="fa-cubes",
category=_("Sources"),
category="Sources",
category_label=_("Sources"),
category_icon='fa-database',)


Expand Down Expand Up @@ -447,7 +452,8 @@ def pre_update(self, obj):

appbuilder.add_view(
SliceModelView,
__("Slices"),
"Slices",
label=_("Slices"),
icon="fa-bar-chart",
category="",
category_icon='',)
Expand Down Expand Up @@ -546,7 +552,8 @@ class LogModelView(CaravelModelView):
LogModelView,
"Action Log",
label=_("Action Log"),
category=_("Security"),
category="Security",
category_label=_("Security"),
icon="fa-list-ol")


Expand Down Expand Up @@ -593,6 +600,7 @@ def post_update(self, datasource):
"Druid Datasources",
label=_("Druid Datasources"),
category="Sources",
category_label=_("Sources"),
icon="fa-cube")


Expand Down Expand Up @@ -1087,6 +1095,7 @@ def welcome(self):
"Refresh Druid Metadata",
href='/caravel/refresh_datasources/',
category='Sources',
category_label=_("Sources"),
category_icon='fa-database',
icon="fa-cog")

Expand All @@ -1104,6 +1113,7 @@ class CssTemplateModelView(CaravelModelView, DeleteMixin):
label=_("CSS Templates"),
icon="fa-css3",
category="Sources",
category_label=_("Sources"),
category_icon='')


Expand Down

0 comments on commit ad5507c

Please sign in to comment.