from typing import Any from django.urls import reverse import dashboard @dashboard.register class DoorControlDashboardFragment(dashboard.DashboardFragment): name = "Door Controls" template = "dashboard/links_card.dj.html" @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"), } } @property def visible(self) -> bool: return self.request.user.has_perm("doorcontrol.view_hidevent")