diff --git a/members/admin/admin_actions.py b/members/admin/admin_actions.py index 74bada16..8826400b 100644 --- a/members/admin/admin_actions.py +++ b/members/admin/admin_actions.py @@ -37,10 +37,12 @@ def invite_many_to_activity_action(modelAdmin, request, queryset): if request.user.is_superuser or request.user.has_perm( "members.view_all_departments" ): - department_list_query = Department.objects.all().order_by("name") + department_list_query = Department.objects.filter( + closed_dtm__isnull=True + ).order_by("name") else: department_list_query = Department.objects.filter( - adminuserinformation__user=request.user + adminuserinformation__user=request.user, closed_dtm__isnull=True ).order_by("name") department_list = [("-", "-")] for department in department_list_query: diff --git a/members/tests/test_admin_admin_actions.py b/members/tests/test_admin_admin_actions.py index 42352de7..9304ebe2 100644 --- a/members/tests/test_admin_admin_actions.py +++ b/members/tests/test_admin_admin_actions.py @@ -28,7 +28,7 @@ def setUp(self): self.admin = AdminActions(Activity, admin.site) self.union = UnionFactory() - self.department = DepartmentFactory(union=self.union) + self.department = DepartmentFactory(union=self.union, closed_dtm=None) self.user = User.objects.create_user( username="user",