From caf8c2cf459d49bced7e0cbf8ff79e6a763eba6c Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 1 Dec 2023 11:55:28 -0500 Subject: [PATCH] doorcontrol: Generate dashboard links for all reports --- doorcontrol/dashboard.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/doorcontrol/dashboard.py b/doorcontrol/dashboard.py index 6050753..7db8e52 100644 --- a/doorcontrol/dashboard.py +++ b/doorcontrol/dashboard.py @@ -1,8 +1,7 @@ from typing import Any -from django.urls import reverse - import dashboard +from .views import REPORTS @dashboard.register @@ -13,16 +12,7 @@ class DoorControlDashboardFragment(dashboard.DashboardFragment): @property def context(self) -> Any: return { - "links": { - "Access Per Day": reverse( - "doorcontrol:access-per-unit-time", kwargs={"unit_time": "day"} - ), - "Access Per Month": reverse( - "doorcontrol:access-per-unit-time", kwargs={"unit_time": "month"} - ), - "Access Failures": reverse("doorcontrol:denied-access"), - "Most Active Members": reverse("doorcontrol:most-active-members"), - } + "links": dict(rt for report in REPORTS for rt in report._report_types()) } @property