doorcontrol: Generate dashboard links for all reports

This commit is contained in:
Adam Goldsmith 2023-12-01 11:55:28 -05:00
parent 654d5e34bd
commit caf8c2cf45

View File

@ -1,8 +1,7 @@
from typing import Any from typing import Any
from django.urls import reverse
import dashboard import dashboard
from .views import REPORTS
@dashboard.register @dashboard.register
@ -13,16 +12,7 @@ class DoorControlDashboardFragment(dashboard.DashboardFragment):
@property @property
def context(self) -> Any: def context(self) -> Any:
return { return {
"links": { "links": dict(rt for report in REPORTS for rt in report._report_types())
"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"),
}
} }
@property @property