diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index f8e62e15..e018c874 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -335,6 +335,9 @@ INVOICE_CURRENCY = "AUD" TICKET_PRODUCT_CATEGORY = 1 ATTENDEE_PROFILE_FORM = "pinaxcon.registrasion.forms.ProfileForm" +#REGIDESK +REGIDESK_BOARDING_GROUP = "Ready For Boarding" + # CSRF custom error screen CSRF_FAILURE_VIEW = "pinaxcon.csrf_view.csrf_failure" diff --git a/vendor/regidesk/regidesk/views.py b/vendor/regidesk/regidesk/views.py index e37ee95d..c10eee04 100644 --- a/vendor/regidesk/regidesk/views.py +++ b/vendor/regidesk/regidesk/views.py @@ -7,6 +7,7 @@ from django.core.mail import EmailMultiAlternatives from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import permission_required, user_passes_test, login_required +from django.contrib.auth.models import User, Group from django.db import transaction from django.db.models import F, Q from django.db.models import Count, Max, Sum @@ -145,6 +146,12 @@ def boarding_prepare(request): @permission_required("regidesk.send_boarding_pass") def boarding_send(request): + BOARDING_GROUP = getattr(settings, "REGIDESK_BOARDING_GROUP", None) + if BOARDING_GROUP and Group.objects.filter(name=BOARDING_GROUP): + boarding_users = User.objects.filter(groups__name=BOARDING_GROUP) + else: + boarding_users = User.objects.all() + attendees = people.Attendee.objects.filter(pk__in=request.session['boarding_attendees']) attendees = attendees.select_related( "user", "attendeeprofilebase", "attendeeprofilebase__attendeeprofile") @@ -197,11 +204,13 @@ def boarding_send(request): if bpass.html_body: msg.attach_alternative(bpass.html_body, "text/html") - msg.send() + if user in boarding_users: + msg.send() + + bpass.sent = datetime.now() + bpass.save() + messages.success(request, "Sent boarding pass to %s" % attendee) - bpass.sent = datetime.now() - bpass.save() - messages.success(request, "Sent boarding pass to %s" % attendee) request.session['boarding_attendees'].remove(attendee.pk) return redirect("regidesk:boarding_overview")