membershipworks: Add changelist action to sync UCS accounts
All checks were successful
Ruff / ruff (push) Successful in 21s

This commit is contained in:
Adam Goldsmith 2024-02-08 15:45:02 -05:00
parent 222f28de16
commit 7fd9181da1

View File

@ -23,6 +23,7 @@ from .tasks.scrape import (
scrape_event_details,
scrape_membershipworks,
)
from .tasks.ucsAccounts import sync_accounts
class ReadOnlyAdmin(admin.ModelAdmin):
@ -37,7 +38,7 @@ class ReadOnlyAdmin(admin.ModelAdmin):
class BaseMembershipWorksAdmin(DjangoObjectActions, ReadOnlyAdmin):
changelist_actions = ("refresh_membershipworks_data",)
changelist_actions = ("refresh_membershipworks_data", "sync_ucs_accounts")
# internal method from DjangoObjectActions
def _get_tool_dict(self, tool_name):
@ -62,6 +63,14 @@ class BaseMembershipWorksAdmin(DjangoObjectActions, ReadOnlyAdmin):
"Queued refresh, please wait a few seconds/minutes then refresh the page",
)
@action
def sync_ucs_accounts(self, request, obj):
async_task(sync_accounts, group=sync_accounts.q_task_group)
self.message_user(
request,
"Queued refresh, please wait a few seconds/minutes then refresh the page",
)
class MemberFlagInline(admin.TabularInline):
model = Member.flags.through