def system_view(request, system_name): try: system = System.objects.get(name=system_name) except System.DoesNotExist: raise Http404 reports = Report.objects.filter(system=system).order_by('-date')[0:5] report_table = ReportTable() for report in reports: report_table.add_report(report, report.date.strftime("%y-%m-%d"), "report/%s/%d" % (system.name, report.id)) return render_to_response('pages/system_view.html', { 'page': 'system_view', 'page_title': system.name, 'settings': settings, 'system': system, 'report_table': report_table })
def system_view(request, system_name): try: system = System.objects.get(name=system_name) except System.DoesNotExist: raise Http404 reports = Report.objects.filter(system=system).order_by('-date')[0:5] report_table = ReportTable() for report in reports: report_table.add_report(report, report.date.strftime("%y-%m-%d"), "report/%s/%d" % (system.name, report.id)) return render_to_response( 'pages/system_view.html', { 'page': 'system_view', 'page_title': system.name, 'settings': settings, 'system': system, 'report_table': report_table })
def home(request): recent_reports = Report.objects.order_by('-date')[0:20] reports = [] systems = set() for report in recent_reports: if report.system in systems: continue systems.add(report.system) reports.append(report) if len(reports) > 5: break report_table = ReportTable() for report in reports: report_table.add_report(report, report.system.name, "system/%s" % report.system.name) return render_to_response('pages/home.html', { 'page': 'home', 'settings': settings, 'report_table': report_table })