diff --git a/gregui/api/views/invitation.py b/gregui/api/views/invitation.py index af633e83e82470f5e0faffd8dda283319fec4a22..2a36d024a488fcec3e01ec1d115bb9fd408143f3 100644 --- a/gregui/api/views/invitation.py +++ b/gregui/api/views/invitation.py @@ -288,8 +288,7 @@ class InvitedGuestView(GenericAPIView): @staticmethod def _illegal_fields(request_data, changeable_fields) -> List[str]: - # Check how many of the allowed fields are filled in - person_data = request_data["person"] + person_data = request_data.get("person", {}) changed_fields = person_data.keys() return list(set(changed_fields) - set(changeable_fields)) diff --git a/gregui/tests/api/views/test_invitation.py b/gregui/tests/api/views/test_invitation.py index 5883fea7c4ef326cb93e586e7b14a369a0d02bda..fba3f5d01a1053b7c0e532e809bac9b07b43bddb 100644 --- a/gregui/tests/api/views/test_invitation.py +++ b/gregui/tests/api/views/test_invitation.py @@ -433,7 +433,6 @@ def test_invalid_date_of_birth_rejected(client, invited_person_verified_nin): person = Person.objects.get() assert person.date_of_birth is None - response = client.post(url, data, format="json") @pytest.mark.django_db