From 0cd88c00f13d193d4cb5384cc6bb88d8b142ff0e Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 28 Aug 2024 17:07:27 -0400 Subject: [PATCH] membershipworks: Add refresh action in EventAdmin --- membershipworks/admin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/membershipworks/admin.py b/membershipworks/admin.py index 45ffb17..deb5001 100644 --- a/membershipworks/admin.py +++ b/membershipworks/admin.py @@ -22,7 +22,7 @@ from .models import ( Member, Transaction, ) -from .tasks.scrape import scrape_event_details, scrape_membershipworks +from .tasks.scrape import scrape_event_details, scrape_events, scrape_membershipworks from .tasks.ucsAccounts import sync_accounts @@ -181,6 +181,7 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin): autocomplete_fields = ["instructor"] change_actions = ["fetch_details"] actions = ["fetch_details"] + changelist_actions = ["refresh_membershipworks_data"] fieldsets = [ ( @@ -224,6 +225,10 @@ class EventAdmin(DjangoObjectActions, admin.ModelAdmin): ), ] + @property + def refresh_membershipworks_data(self): + return run_task_action(self, "Refresh Data", scrape_events) + def get_readonly_fields(self, request: HttpRequest, obj: EventExt) -> list[str]: fields = [] for field in Event._meta.get_fields():