diff --git a/backend/kesaseteli/applications/api/v1/serializers.py b/backend/kesaseteli/applications/api/v1/serializers.py index 13aac44973..d2a651a0f8 100644 --- a/backend/kesaseteli/applications/api/v1/serializers.py +++ b/backend/kesaseteli/applications/api/v1/serializers.py @@ -224,7 +224,10 @@ class EmployerSummerVoucherSerializer(serializers.ModelSerializer): ) target_group = serializers.ChoiceField( - choices=get_target_group_choices(), required=False + choices=get_target_group_choices(), + required=False, + allow_blank=True, + allow_null=True, ) class Meta: @@ -275,7 +278,9 @@ def _validate_non_draft_required_fields(self, data): } ) - def _update_target_group(self, instance: EmployerSummerVoucher, target_group: str): + def _update_target_group( + self, instance: EmployerSummerVoucher, target_group: Optional[str] + ): """ Update the target_group of the youth voucher if it exists.