1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Implemented rough UI for accessing report results

This commit is contained in:
Jeremy Stretch
2017-09-22 12:11:10 -04:00
parent b5ab498e75
commit 79fdf641c0
6 changed files with 85 additions and 18 deletions

View File

@ -1,7 +1,8 @@
from __future__ import unicode_literals
from collections import OrderedDict
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.shortcuts import get_object_or_404, redirect, render
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.views.generic import View
@ -52,9 +53,19 @@ class ReportListView(View):
def get(self, request):
reports = get_reports()
results = {r.name: r for r in ReportResult.objects.all()}
results = {r.report: r for r in ReportResult.objects.all()}
foo = []
for module, report_list in reports:
module_reports = []
for report_name, report_class in report_list:
module_reports.append({
'name': report_name,
'description': report_class.description,
'results': results.get('{}.{}'.format(module, report_name), None)
})
foo.append((module, module_reports))
return render(request, 'extras/report_list.html', {
'reports': reports,
'results': results,
'reports': foo,
})