Verified Commit 1ff181d6 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Handle update of present/payment fields separately

parent 2727b297
...@@ -187,8 +187,14 @@ class RegistrationViewSet(GenericViewSet, RetrieveModelMixin, ...@@ -187,8 +187,14 @@ class RegistrationViewSet(GenericViewSet, RetrieveModelMixin,
return super().get_serializer(*args, **kwargs) return super().get_serializer(*args, **kwargs)
def perform_update(self, serializer): def perform_update(self, serializer):
registration = serializer.instance registration = serializer.instance
if services.is_organiser(self.request.member, registration.event):
services.update_registration(registration.member, services.update_registration(registration.member,
registration.event, registration.event,
serializer.field_values()) serializer.field_values())
...@@ -233,3 +233,17 @@ def registration_fields(request, member, event): ...@@ -233,3 +233,17 @@ def registration_fields(request, member, event):
else: else:
raise RegistrationError( raise RegistrationError(
_("You are not allowed to update this registration.")) _("You are not allowed to update this registration."))
def update_registration_by_organiser(registration, member, data):
if not is_organiser(member, registration.event):
raise RegistrationError(
_("You are not allowed to update this registration."))
if 'payment' in data:
registration.payment = data['payment']
if 'present' in data:
registration.present = data['present']
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