Exemplo n.º 1
0
def report(request, section, name):
    ctx = _default_context(request)
    report, register = site.get_report_and_register(request, section, name)
    if not report or not register:
        if LOGGING:
            logger = logging.getLogger('reportapi.views.report')
            logger.error(force_text(
                _('Report or register not found for section (%(section)s) and name (%(name)s).')
                % {'section': section, 'name': name}
            ))
        return render(request, 'reportapi/404.html', ctx)

    ctx['report_as_json'] = tojson(report.get_scheme(request) or dict())
    ctx['report']  = report
    ctx['filters_list'] = report.filters_list(request)
    ctx['section'] = site.sections[section]

    return render(request, 'reportapi/report.html', ctx)
Exemplo n.º 2
0
 def __str__(self):
     dic = self.get_dict()
     return tojson(dic)