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", ), 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