X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetstack%2Fcore%2Fdashboard%2Fviews%2Fhome.py;h=6f57666c161ade5ad264e64fc1d9d5d21b6f7574;hb=d6a61aef42561ea138fcb7b192f3082e018b852b;hp=ff6c445d787e69ee81d144f1e11330f111242346;hpb=5576645929173354b0106ab7cf67ed172abae0fd;p=plstackapi.git diff --git a/planetstack/core/dashboard/views/home.py b/planetstack/core/dashboard/views/home.py index ff6c445..6f57666 100644 --- a/planetstack/core/dashboard/views/home.py +++ b/planetstack/core/dashboard/views/home.py @@ -14,6 +14,11 @@ class DashboardDynamicView(TemplateView): {% block content %} """ + head_wholePage_template = r"""{% extends "admin/wholePage.html" %} + {% load admin_static %} + {% block content %} + """ + tail_template = r"{% endblock %}" def get(self, request, name="root", *args, **kwargs): @@ -22,6 +27,8 @@ class DashboardDynamicView(TemplateView): if name=="root": return self.multiDashboardView(request, context) + elif kwargs.get("wholePage",None): + return self.singleFullView(request, name, context) else: return self.singleDashboardView(request, name, context) @@ -68,14 +75,41 @@ class DashboardDynamicView(TemplateView): dashboards.append(customize[0]) for i,view in enumerate(dashboards): + # don't display disabled dashboards + if (not view.enabled): + continue body = body + '
  • %s
  • \n' % (i, view.name) body = body + "\n" for i,view in enumerate(dashboards): + # don't display disabled dashboards + if (not view.enabled): + continue + url = view.url body = body + '
    \n' % i - body = body + self.embedDashboard(url) + if (view.controllers.all().count()>0): + body = body + '' + + for j,controllerdashboard in enumerate(view.controllerdashboardviews.all()): + body = body + '\n' % (i,j, self.embedDashboard(controllerdashboard.url)); + + body = body + '
    \n' % i + + body = body + """ + """ % (i,i,i,i,i,i); + else: + body = body + self.embedDashboard(url) body = body + '
    \n' body=body+"\n" @@ -104,3 +138,17 @@ class DashboardDynamicView(TemplateView): context = context, **response_kwargs) + def singleFullView(self, request, name, context): + head_template = self.head_wholePage_template + tail_template = self.tail_template + + t = template.Template(head_template + self.readTemplate(name) + self.tail_template) + + response_kwargs = {} + response_kwargs.setdefault('content_type', self.content_type) + return self.response_class( + request = request, + template = t, + context = context, + **response_kwargs) +