cmsmanage/membershipworks/dashboard.py

55 lines
1.7 KiB
Python
Raw Permalink Normal View History

from django.urls import reverse
import dashboard
from dashboard import Link
from membershipworks.models import EventExt, Member
@dashboard.register
class MembershipworksDashboardFragment(dashboard.LinksCardDashboardFragment):
name = "MembershipWorks"
@property
def links(self):
links = [
Link(
"Upcoming Events WordPress Post Generator",
reverse("membershipworks:upcoming-events-wordpress"),
permission="membershipworks.view_event",
tooltip="Copy to clipbard doesn't work on Safari!",
),
Link(
"Current and Upcoming Events",
reverse("membershipworks:current-and-upcoming-events"),
permission="membershipworks.view_event",
),
Link(
"Event Report",
reverse("membershipworks:event-index-report"),
permission="membershipworks.view_event",
),
Link(
"Event Attendees",
reverse("membershipworks:event-attendees"),
permission="membershipworks.view_event",
),
Link(
"Missing Paperwork",
reverse("membershipworks:missing-paperwork-report"),
permission="membershipworks.view_member",
),
]
member = Member.from_user(self.request.user)
if (
member is not None
and EventExt.objects.filter(instructor__member=member).exists()
):
links.append(
Link(
"My Events", reverse("membershipworks:user-events"), permission=None
)
)
return links