Commit 12daef3f authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'fix/events-mark-present' into 'master'

Fix marking everyone at event as present

Closes #323

See merge request !354
parents 92338797 80ee93dc
......@@ -302,9 +302,15 @@ def registration(request, event_id, action=None):
@permission_required('events.change_event')
def all_present(request, event_id):
event = get_object_or_404(Event, pk=event_id)
registrations = event.registration_set.all()
for registration in registrations:
registration.present = True
registration.paid = True
registration.save()
if event.max_participants is None:
registrations_query = event.registration_set.filter(
date_cancelled=None)
else:
registrations_query = (event.registration_set
.filter(date_cancelled=None)
.order_by('date')[:event.max_participants])
registrations_query.update(present=True, paid=True)
return HttpResponseRedirect('/events/admin/{}'.format(event_id))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment