From bea87bd7caa26cc1779366d46b60365eddcc4b94 Mon Sep 17 00:00:00 2001 From: mhewel <58829786+mhewel@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:53:06 +0100 Subject: [PATCH] =?UTF-8?q?Send=20invitationer=20baseret=20p=C3=A5=20tidli?= =?UTF-8?q?gere=20invitationer=20i=20Admin=20>=20Invitationer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit På samme måde som personer kan vælges i Admin > Deltagere, Admin > Personer og Admin > Ventelister --- members/admin/activityinvite_admin.py | 8 +++++++- members/admin/admin_actions.py | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/members/admin/activityinvite_admin.py b/members/admin/activityinvite_admin.py index 24deb6b0..d73e9226 100644 --- a/members/admin/activityinvite_admin.py +++ b/members/admin/activityinvite_admin.py @@ -23,6 +23,8 @@ Person, ) +from members.admin.admin_actions import AdminActions + class ActivityInviteAdminForm(forms.ModelForm): class Meta: @@ -166,7 +168,11 @@ class Meta: "Du kan søge på forening, afdeling, aktivitet eller person.
Vandret dato-filter er for aktivitetens startdato." ) - actions = ["export_csv_invitation_info", "extend_invitations"] + actions = [ + "export_csv_invitation_info", + "extend_invitations", + AdminActions.invite_many_to_activity_action, + ] form = ActivityInviteAdminForm diff --git a/members/admin/admin_actions.py b/members/admin/admin_actions.py index 8826400b..e65edbee 100644 --- a/members/admin/admin_actions.py +++ b/members/admin/admin_actions.py @@ -93,6 +93,10 @@ class MassInvitationForm(forms.Form): elif queryset.model is ActivityParticipant: q = [pa.person.pk for pa in queryset] persons = Person.objects.filter(pk__in=q) + elif queryset.model is ActivityInvite: + persons = Person.objects.filter( + pk__in=queryset.values_list("person_id", flat=True) + ) else: persons = queryset