Compare commits
No commits in common. "adc882444cea60f326c17a1345c97efd70b7def8" and "babe9738635174cd734ab991ae0fb57362087d2f" have entirely different histories.
adc882444c
...
babe973863
@ -13,15 +13,10 @@ class MembershipworksDashboardFragment(dashboard.LinksCardDashboardFragment):
|
||||
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"),
|
||||
"Upcoming Events",
|
||||
reverse("membershipworks:upcoming-events"),
|
||||
permission="membershipworks.view_event",
|
||||
tooltip="Generator for Wordpress posts",
|
||||
),
|
||||
Link(
|
||||
"Event Report",
|
||||
|
@ -509,13 +509,6 @@ class EventExtManager(models.Manager):
|
||||
.values("d")[:1],
|
||||
output_field=models.IntegerField(),
|
||||
),
|
||||
next_meeting_start=Subquery(
|
||||
EventMeetingTime.objects.filter(
|
||||
event=OuterRef("pk"), end__gt=timezone.now()
|
||||
)
|
||||
.order_by("start")
|
||||
.values("start")[:1]
|
||||
),
|
||||
duration=Subquery(
|
||||
EventMeetingTime.objects.filter(event=OuterRef("pk"))
|
||||
.values("event__pk")
|
||||
|
@ -27,7 +27,6 @@ class EventTable(tables.Table):
|
||||
'<a title="MembershipWorks" href="https://membershipworks.com/admin/#!event/admin/{{ record.url }}">{{ value }}</a> '
|
||||
'<a title="Admin" href="{% url "admin:membershipworks_eventext_change" record.pk %}"><i class="bi bi-pencil-square"></i></a> '
|
||||
'<a title="Details" href="{% url "membershipworks:event-detail" record.pk %}"><i class="bi bi-receipt"></i></a> '
|
||||
'<a title="Registrations" href="{% url "membershipworks:event-registrations" record.pk %}"><i class="bi bi-people"></i></a> '
|
||||
),
|
||||
accessor="unescaped_title",
|
||||
)
|
||||
@ -116,26 +115,6 @@ class UserEventTable(EventTable):
|
||||
net_revenue = None
|
||||
|
||||
|
||||
class CurrentAndUpcomingEventTable(EventTable):
|
||||
next_meeting = tables.DateTimeColumn("N d, Y H:i", accessor="next_meeting_start")
|
||||
person_hours = None
|
||||
total_due_to_instructor = None
|
||||
invoice__date_submitted = None
|
||||
invoice__date_paid = None
|
||||
gross_revenue = None
|
||||
net_revenue = None
|
||||
|
||||
class Meta(EventTable.Meta):
|
||||
row_attrs = {
|
||||
"class": lambda table, record: (
|
||||
""
|
||||
if record.cap is None or record.cap > 0
|
||||
else "text-decoration-line-through table-danger"
|
||||
)
|
||||
}
|
||||
sequence = ("title", "start", "next_meeting")
|
||||
|
||||
|
||||
class InvoiceMoneyColumn(tables.columns.Column):
|
||||
def render(self, value):
|
||||
return f"${super().render(value):.2f}"
|
||||
|
@ -1,14 +0,0 @@
|
||||
{% extends "base.dj.html" %}
|
||||
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block title %}Current and Upcoming Events{% endblock %}
|
||||
{% block admin_link %}
|
||||
{% url 'admin:membershipworks_eventext_changelist' %}
|
||||
{% endblock %}
|
||||
{% block breadcrumbs %}
|
||||
<li class="breadcrumb-item active" aria-current="page">Current and Upcoming Events</li>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% render_table table %}
|
||||
{% endblock %}
|
@ -11,14 +11,9 @@ urlpatterns = [
|
||||
name="member-autocomplete",
|
||||
),
|
||||
path(
|
||||
"upcoming-events-wordpress/",
|
||||
views.upcoming_events_wordpress,
|
||||
name="upcoming-events-wordpress",
|
||||
),
|
||||
path(
|
||||
"current-and-upcoming-events/",
|
||||
views.CurrentAndUpcomingEventView.as_view(),
|
||||
name="current-and-upcoming-events",
|
||||
"upcoming-events/",
|
||||
views.upcoming_events,
|
||||
name="upcoming-events",
|
||||
),
|
||||
path(
|
||||
"event-report/",
|
||||
|
@ -46,7 +46,6 @@ from .forms import EventInvoiceForm
|
||||
from .invoice_email import make_invoice_emails
|
||||
from .models import EventAttendee, EventExt, EventInvoice, Member
|
||||
from .tables import (
|
||||
CurrentAndUpcomingEventTable,
|
||||
EventAttendeeTable,
|
||||
EventRegistrationsTable,
|
||||
EventSummaryTable,
|
||||
@ -69,7 +68,7 @@ class MemberAutocomplete(autocomplete.Select2QuerySetView):
|
||||
|
||||
|
||||
@permission_required("membershipworks.view_eventext")
|
||||
def upcoming_events_wordpress(request):
|
||||
def upcoming_events(request):
|
||||
now = datetime.now()
|
||||
|
||||
membershipworks = MembershipWorks()
|
||||
@ -235,7 +234,7 @@ class EventMonthReport(
|
||||
return (
|
||||
super()
|
||||
.get_table_data()
|
||||
.select_related("category", "instructor", "instructor__member", "invoice")
|
||||
.select_related("category", "instructor", "invoice")
|
||||
.with_financials()
|
||||
)
|
||||
|
||||
@ -243,24 +242,6 @@ class EventMonthReport(
|
||||
return f"mw_events_{self.get_year()}-{self.get_month():02}.{export_format}"
|
||||
|
||||
|
||||
class CurrentAndUpcomingEventView(SingleTableMixin, PermissionRequiredMixin, ListView):
|
||||
permission_required = "membershipworks.view_eventext"
|
||||
queryset = EventExt.objects.all()
|
||||
date_field = "start"
|
||||
template_name = "membershipworks/current_and_upcoming_events.dj.html"
|
||||
table_class = CurrentAndUpcomingEventTable
|
||||
|
||||
def get_table_data(self):
|
||||
return (
|
||||
super()
|
||||
.get_table_data()
|
||||
.order_by("next_meeting_start")
|
||||
.filter(end__gt=timezone.now())
|
||||
.select_related("category", "instructor", "instructor__member")
|
||||
.with_financials()
|
||||
)
|
||||
|
||||
|
||||
class UserEventView(SingleTableMixin, ListView):
|
||||
model: type[EventExt] = EventExt
|
||||
table_class = UserEventTable
|
||||
@ -281,7 +262,7 @@ class UserEventView(SingleTableMixin, ListView):
|
||||
return (
|
||||
super()
|
||||
.get_table_data()
|
||||
.select_related("category", "invoice")
|
||||
.select_related("category", "instructor", "invoice")
|
||||
.with_financials()
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user