From 2cc6f9d2e02d909768d249b87136fe30281d5dbe Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 9 Sep 2024 19:45:52 -0400 Subject: [PATCH] membershipworks: Add more useful MW links to EventAdmin change page --- membershipworks/admin.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/membershipworks/admin.py b/membershipworks/admin.py index 1b49775..192c535 100644 --- a/membershipworks/admin.py +++ b/membershipworks/admin.py @@ -195,6 +195,7 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin): "instructor_percentage", "instructor_flat_rate", ("should_survey", "survey_email_sent"), + "links", ] }, ), @@ -204,7 +205,7 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin): "classes": ["collapse"], "fields": [ "eid", - "_url", + "url", "start", "end", "duration", @@ -242,12 +243,15 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin): for field in Event._meta.get_fields(): if field.auto_created or field.many_to_many or not field.concrete: continue - elif field.name == "url": - fields.append("_url") else: fields.append(field.name) fields.insert(fields.index("end") + 1, "duration") - fields += ["details_timestamp", "details", "registrations"] + fields += [ + "links", + "details_timestamp", + "details", + "registrations", + ] return fields @admin.display(ordering="title") @@ -258,10 +262,11 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin): def duration(self, obj): return obj.duration - @admin.display(description="URL") - def _url(self, obj): + @admin.display(description="MembershipWorks links") + def links(self, obj): return format_html( - '{0}', + 'Admin | ' + 'Event List', obj.url, )