예제 #1
0
    def override_navigation_list(cls, context):
        current_slug = context.get('report', {}).get('sub_slug')
        domain = context.get('domain')

        subreport_context = []
        subreports = ADMReport.get_default_subreports(domain, cls.adm_slug)

        if not subreports:
            subreport_context.append({
                'url': '#', 
                'warning_label': 'No ADM Reports Configured',
            })
            return subreport_context

        for report in subreports:
            key = report.get("key", [])
            entry = report.get("value", {})
            report_slug = key[-2]
            if cls.show_subreport_in_navigation(report_slug):
                subreport_context.append({
                    'is_active': current_slug == report_slug,
                    'url': cls.get_url(domain=domain, subreport=report_slug),
                    'description': entry.get('description', ''),
                    'title': entry.get('name', 'Untitled Report'),
                })
        return subreport_context
예제 #2
0
    def override_navigation_list(cls, context):
        current_slug = context.get('report', {}).get('sub_slug')
        domain = context.get('domain')

        subreport_context = []
        subreports = ADMReport.get_default_subreports(domain, cls.adm_slug)

        if not subreports:
            subreport_context.append({
                'url':
                '#',
                'warning_label':
                'No ADM Reports Configured',
            })
            return subreport_context

        for report in subreports:
            key = report.get("key", [])
            entry = report.get("value", {})
            report_slug = key[-2]
            if cls.show_subreport_in_navigation(report_slug):
                subreport_context.append({
                    'is_active':
                    current_slug == report_slug,
                    'url':
                    cls.get_url(domain=domain, subreport=report_slug),
                    'description':
                    entry.get('description', ''),
                    'title':
                    entry.get('name', 'Untitled Report'),
                })
        return subreport_context
예제 #3
0
 def subreport_data(self):
     default_subreport = ADMReport.get_default(self.subreport_slug,
                                               domain=self.domain,
                                               section=self.adm_slug,
                                               wrap=False)
     if default_subreport is None:
         return dict()
     return default_subreport
예제 #4
0
 def adm_report(self):
     if self.subreport_data:
         try:
             adm_report = ADMReport.get_correct_wrap(self.subreport_data.get('key')[-1])
             adm_report.set_domain_specific_values(self.domain)
             return adm_report
         except Exception as e:
             logging.error("Could not fetch ADM Report: %s" % e)
     return None
예제 #5
0
 def adm_report(self):
     if self.subreport_data:
         try:
             adm_report = ADMReport.get_correct_wrap(
                 self.subreport_data.get('key')[-1])
             adm_report.set_domain_specific_values(self.domain)
             return adm_report
         except Exception as e:
             logging.error("Could not fetch ADM Report: %s" % e)
     return None
예제 #6
0
 def subreport_data(self):
     default_subreport = ADMReport.get_default(self.subreport_slug, domain=self.domain,
             section=self.adm_slug, wrap=False)
     if default_subreport is None:
         return dict()
     return default_subreport