membershipworks: Add refresh action in EventAdmin
This commit is contained in:
parent
c356913a8b
commit
0cd88c00f1
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user