Skip to content

Commit

Permalink
Add set_club_open to club admin actions & change defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Cameron <git@jasoncameron.dev>
  • Loading branch information
JasonLovesDoggo committed Oct 3, 2024
1 parent 266ed0e commit 8700400
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -156,6 +157,7 @@ class OrganizationAdmin(admin.ModelAdmin):
OrganizationURLInline,
]
actions = [
set_club_open,
set_club_unactive,
set_club_active,
reset_club_president,
Expand Down
3 changes: 2 additions & 1 deletion core/management/commands/add_clubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions core/utils/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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."),
Expand Down

0 comments on commit 8700400

Please sign in to comment.