cmsmanage/membershipworks/dashboard.py

27 lines
770 B
Python
Raw Normal View History

from typing import Any
from django.urls import reverse
import dashboard
@dashboard.register
class MembershipworksDashboardFragment(dashboard.DashboardFragment):
name = "MembershipWorks"
template = "dashboard/links_card.dj.html"
@property
def context(self) -> Any:
links = {}
if self.request.user.has_perm("membershipworks.view_event"):
links["Upcoming Events"] = reverse("membershipworks:upcoming-events")
links["Event Report"] = reverse("membershipworks:event-index-report")
links["Event Attendees"] = reverse("membershipworks:event-attendees")
return {"links": links}
@property
def visible(self) -> bool:
return self.request.user.has_perm("doorcontrol.view_hidevent")