Beispiel #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
Beispiel #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