Loading dashboard by id instead of name
diff --git a/xos/core/dashboard/sites.py b/xos/core/dashboard/sites.py
index de100af..c68ce78 100644
--- a/xos/core/dashboard/sites.py
+++ b/xos/core/dashboard/sites.py
@@ -33,7 +33,7 @@
name="test"),
url(r'^sliceinteractions/(?P<name>\w+)/$', self.admin_view(DashboardSliceInteractions.as_view()),
name="interactions"),
- url(r'^dashboard/(?P<name>\w+)/$', self.admin_view(DashboardDynamicView.as_view()),
+ url(r'^dashboard/(?P<name>[\w|\W]+)/$', self.admin_view(DashboardDynamicView.as_view()),
name="dashboard"),
url(r'^dashboardWholePage/(?P<name>\w+)/$', self.admin_view(DashboardDynamicView.as_view()),
{"wholePage": True},
diff --git a/xos/core/dashboard/views/home.py b/xos/core/dashboard/views/home.py
index baf0435..052cc21 100644
--- a/xos/core/dashboard/views/home.py
+++ b/xos/core/dashboard/views/home.py
@@ -29,7 +29,7 @@
if name=="root":
# maybe it is a bit hacky, didn't want to mess up everything @teone
user_dashboards = request.user.get_dashboards()
- first_dasboard_name = user_dashboards[0].name.lower();
+ first_dasboard_name = user_dashboards[0].id;
return self.singleDashboardView(request, first_dasboard_name, context)
# return self.multiDashboardView(request, context)
elif kwargs.get("wholePage",None):
@@ -41,8 +41,12 @@
TEMPLATE_DIRS = [XOS_DIR + "/templates/admin/dashboard/",
XOS_DIR + "/core/xoslib/dashboards/"]
+ # starting from the ID loading the template name
+ current_dasboard = DashboardView.objects.filter(id=fn)
+ template_url = current_dasboard[0].url.replace("template:",'')
+
for template_dir in TEMPLATE_DIRS:
- pathname = os.path.join(template_dir, fn) + ".html"
+ pathname = os.path.join(template_dir, template_url) + ".html"
if os.path.exists(pathname):
break
else:
@@ -161,6 +165,8 @@
head_template = self.head_template
tail_template = self.tail_template
+ print >>sys.stderr, name
+
t = template.Template(head_template + self.readTemplate(name) + self.tail_template)
response_kwargs = {}
diff --git a/xos/templates/admin/tags/dashboard_list.html b/xos/templates/admin/tags/dashboard_list.html
index 7656e34..55660c8 100644
--- a/xos/templates/admin/tags/dashboard_list.html
+++ b/xos/templates/admin/tags/dashboard_list.html
@@ -1,7 +1,7 @@
<ul>
{% for dashboard in dashboards %}
<li>
- <a href="/admin/dashboard/{{ dashboard.name|lower }}">{{ dashboard.name }}</a>
+ <a href="/admin/dashboard/{{ dashboard.id}}">{{ dashboard.name }}</a>
</li>
{% endfor %}
</ul>
\ No newline at end of file