membershipworks: Add changelist action to sync UCS accounts
All checks were successful
Ruff / ruff (push) Successful in 21s
All checks were successful
Ruff / ruff (push) Successful in 21s
This commit is contained in:
parent
222f28de16
commit
7fd9181da1
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user