From 870040037ba32b0984cf5880792567e63de9df82 Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Thu, 3 Oct 2024 11:27:56 -0400 Subject: [PATCH] Add set_club_open to club admin actions & change defaults Signed-off-by: Jason Cameron --- core/admin.py | 2 ++ core/management/commands/add_clubs.py | 3 ++- core/utils/actions.py | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/admin.py b/core/admin.py index c3164d40..d7f64b41 100644 --- a/core/admin.py +++ b/core/admin.py @@ -34,6 +34,7 @@ reset_club_president, send_notif_singleday, send_test_notif, + set_club_open, set_club_active, set_club_unactive, set_post_archived, @@ -156,6 +157,7 @@ class OrganizationAdmin(admin.ModelAdmin): OrganizationURLInline, ] actions = [ + set_club_open, set_club_unactive, set_club_active, reset_club_president, diff --git a/core/management/commands/add_clubs.py b/core/management/commands/add_clubs.py index 1d81e565..b0d34dc6 100644 --- a/core/management/commands/add_clubs.py +++ b/core/management/commands/add_clubs.py @@ -123,7 +123,8 @@ def handle(self, *args, **options): "extra_content": time_and_place + "\n\n" + social_links, "show_members": True, "is_active": True, - "is_open": False, + "is_open": True, + "applications_open": True, }, # fmt: on diff --git a/core/utils/actions.py b/core/utils/actions.py index 055fc895..6dc976b5 100644 --- a/core/utils/actions.py +++ b/core/utils/actions.py @@ -13,6 +13,7 @@ from core.utils.ratelimiting import admin_action_rate_limit __all__ = [ + "set_club_open", "set_club_unactive", "set_club_active", "reset_club_president", @@ -43,6 +44,13 @@ def set_club_active(modeladmin, request, queryset: QuerySet[Organization]): queryset.update(is_active=True) +@admin.action( + permissions=["change"], description=__("Set the selected clubs to open membership") +) +def set_club_open(modeladmin, request, queryset: QuerySet[Organization]): + queryset.update(is_open=True, applications_open=True) + + @admin.action( permissions=["change"], description=__("Set selected club's president to a temp user."),