From 489605916200a718c0b5ec18a35521b07099ea0c Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Thu, 8 Oct 2020 12:50:29 -0500 Subject: [PATCH] Fixes: #5220 - Fix API patch request against IP-Address endpoint with null assigned_object_type --- docs/release-notes/version-2.9.md | 1 + netbox/ipam/api/serializers.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index fc64d02ec..264004281 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -14,6 +14,7 @@ * [#5206](https://github.com/netbox-community/netbox/issues/5206) - Apply user pagination preferences to all paginated object lists * [#5217](https://github.com/netbox-community/netbox/issues/5217) - Prevent erroneous removal of prefetched GenericForeignKey data from tables * [#5218](https://github.com/netbox-community/netbox/issues/5218) - Raise validation error if a power port's `allocated_draw` exceeds its `maximum_draw` +* [#5220](https://github.com/netbox-community/netbox/issues/5220) - Fix API patch request against IP Address endpoint with null assigned_object_type * [#5221](https://github.com/netbox-community/netbox/issues/5221) - Fix bulk component creation for virtual machines --- diff --git a/netbox/ipam/api/serializers.py b/netbox/ipam/api/serializers.py index 6be0b8a42..ea84191f1 100644 --- a/netbox/ipam/api/serializers.py +++ b/netbox/ipam/api/serializers.py @@ -219,7 +219,8 @@ class IPAddressSerializer(TaggedObjectSerializer, CustomFieldModelSerializer): role = ChoiceField(choices=IPAddressRoleChoices, allow_blank=True, required=False) assigned_object_type = ContentTypeField( queryset=ContentType.objects.filter(IPADDRESS_ASSIGNMENT_MODELS), - required=False + required=False, + allow_null=True ) assigned_object = serializers.SerializerMethodField(read_only=True) nat_inside = NestedIPAddressSerializer(required=False, allow_null=True)