paperwork: Add deskers mailing list

This commit is contained in:
Adam Goldsmith 2023-08-26 20:20:05 -04:00
parent a3a8c305ac
commit 1aa0bd6014

View File

@ -1,5 +1,5 @@
from django.db.models import Prefetch
from rest_framework import routers, serializers, viewsets
from django.db.models import Prefetch, Q
from rest_framework.decorators import action
from rest_framework.response import Response
@ -98,6 +98,21 @@ class DepartmentViewSet(viewsets.ModelViewSet):
},
}
# TODO: this isn't really in the domain of the `paperwork` app...
deskers = (
Member.objects.with_is_active()
.filter(is_active=True)
.filter(
Member.objects.has_flag("label", "Volunteer: Desker")
| Q(billing_method__startswith="Desker")
)
)
lists["Deskers"] = {
"members": {
desker.sanitized_mailbox(use_volunteer=True) for desker in deskers
}
}
return Response(lists)