Reduced participant fee: added toggle buttons within office views and
All checks were successful
buildbot/tox Build done.

improved html
This commit is contained in:
2020-12-18 11:48:10 +01:00
parent dab2e5cb76
commit cbc3df97c1
5 changed files with 104 additions and 40 deletions

View File

@@ -219,6 +219,16 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
participants_trash = event.trashed_participants.all()
context['participants_trash'] = participants_trash
earnings = 0
if event.charge:
for participant in participants:
if participant.paid:
if participant.apply_reduced_fee:
earnings += event.charge / 2
else:
earnings += event.charge
context['earnings'] = earnings
if participants.count() > 1:
email_list = [u'"{}" <{}>'.format(p.get_full_name(), p.email_address) for p in participants]
email_list.sort()
@@ -344,6 +354,12 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView):
self._reset_registration(registration)
else:
raise FieldDoesNotExist('Event has no registrations')
elif action == 'toggle_reduced_fee':
self.enforce_permission(event, permission='payment')
participant_id = request.POST.get('id')
participant = event.participants.get(id=participant_id)
participant.apply_reduced_fee = not participant.apply_reduced_fee
participant.save()
elif action == 'confirm_payment':
self.enforce_permission(event, permission='payment')
participant_id = request.POST.get('id')