From 48a036204d372c117e68f1f34630d95343d384b9 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Fri, 2 Sep 2016 15:14:54 +1000 Subject: [PATCH] Reporting framework can now display multiple sections. --- registrasion/reporting/reports.py | 8 ++++++-- registrasion/urls.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/registrasion/reporting/reports.py b/registrasion/reporting/reports.py index f8339a5d..e756622e 100644 --- a/registrasion/reporting/reports.py +++ b/registrasion/reporting/reports.py @@ -13,6 +13,7 @@ _all_report_views = [] class Report(object): def __init__(self, title, headings, data, link_view=None): + self._title = title self._headings = headings self._data = data self._link_view = link_view @@ -66,12 +67,15 @@ def report_view(title, form_type=None): else: form = None - report = view(request, form, *a, **k) + reports = view(request, form, *a, **k) + + if isinstance(reports, Report): + reports = [reports] ctx = { "title": title, "form": form, - "report": report, + "reports": reports, } return render(request, "registrasion/report.html", ctx) diff --git a/registrasion/urls.py b/registrasion/urls.py index b6b120c1..5c304091 100644 --- a/registrasion/urls.py +++ b/registrasion/urls.py @@ -37,6 +37,8 @@ public = [ reports = [ url(r"^$", reporting_views.reports_list, name="reports_list"), + url(r"^attendee/?$", reporting_views.attendee, name="attendee"), + url(r"^attendee/([0-9]*)$", reporting_views.attendee, name="attendee"), url( r"^credit_notes/?$", reporting_views.credit_notes,