Skip to content

Commit

Permalink
Hack to log dashboard_ids when slugs are used
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Feb 10, 2016
1 parent 07d52ed commit e39d6db
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions panoramix/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,6 @@ def testconn(self):

@has_access
@expose("/dashboard/<dashboard_id>/")
@utils.log_this
def dashboard(self, dashboard_id):
session = db.session()
qry = session.query(models.Dashboard)
Expand All @@ -546,14 +545,21 @@ def dashboard(self, dashboard_id):

templates = session.query(models.CssTemplate).all()

dashboard = qry.first()
dash = qry.first()

# Hack to log the dashboard_id properly, even when getting a slug
@utils.log_this
def dashboard(**kwargs):
pass
dashboard(dashboard_id=dash.id)

pos_dict = {}
if dashboard.position_json:
if dash.position_json:
pos_dict = {
int(o['slice_id']):o
for o in json.loads(dashboard.position_json)}
for o in json.loads(dash.position_json)}
return self.render_template(
"panoramix/dashboard.html", dashboard=dashboard,
"panoramix/dashboard.html", dashboard=dash,
templates=templates,
pos_dict=pos_dict)

Expand Down

0 comments on commit e39d6db

Please sign in to comment.