mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #4049: Restore missing tags field in IPAM service serializer
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
* [#4043](https://github.com/netbox-community/netbox/issues/4043) - Fix toggling of required fields in custom scripts
|
* [#4043](https://github.com/netbox-community/netbox/issues/4043) - Fix toggling of required fields in custom scripts
|
||||||
|
* [#4049](https://github.com/netbox-community/netbox/issues/4049) - Restore missing `tags` field in IPAM service serializer
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class AvailableIPSerializer(serializers.Serializer):
|
|||||||
# Services
|
# Services
|
||||||
#
|
#
|
||||||
|
|
||||||
class ServiceSerializer(CustomFieldModelSerializer):
|
class ServiceSerializer(TaggitSerializer, CustomFieldModelSerializer):
|
||||||
device = NestedDeviceSerializer(required=False, allow_null=True)
|
device = NestedDeviceSerializer(required=False, allow_null=True)
|
||||||
virtual_machine = NestedVirtualMachineSerializer(required=False, allow_null=True)
|
virtual_machine = NestedVirtualMachineSerializer(required=False, allow_null=True)
|
||||||
protocol = ChoiceField(choices=ServiceProtocolChoices)
|
protocol = ChoiceField(choices=ServiceProtocolChoices)
|
||||||
@ -247,10 +247,11 @@ class ServiceSerializer(CustomFieldModelSerializer):
|
|||||||
required=False,
|
required=False,
|
||||||
many=True
|
many=True
|
||||||
)
|
)
|
||||||
|
tags = TagListSerializerField(required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Service
|
model = Service
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'device', 'virtual_machine', 'name', 'port', 'protocol', 'ipaddresses', 'description',
|
'id', 'device', 'virtual_machine', 'name', 'port', 'protocol', 'ipaddresses', 'description', 'tags',
|
||||||
'custom_fields', 'created', 'last_updated',
|
'custom_fields', 'created', 'last_updated',
|
||||||
]
|
]
|
||||||
|
@ -1064,6 +1064,7 @@ class ServiceTest(APITestCase):
|
|||||||
'name': 'Test Service 4',
|
'name': 'Test Service 4',
|
||||||
'protocol': ServiceProtocolChoices.PROTOCOL_TCP,
|
'protocol': ServiceProtocolChoices.PROTOCOL_TCP,
|
||||||
'port': 4,
|
'port': 4,
|
||||||
|
'tags': ['Foo', 'Bar'],
|
||||||
}
|
}
|
||||||
|
|
||||||
url = reverse('ipam-api:service-list')
|
url = reverse('ipam-api:service-list')
|
||||||
@ -1076,6 +1077,8 @@ class ServiceTest(APITestCase):
|
|||||||
self.assertEqual(service4.name, data['name'])
|
self.assertEqual(service4.name, data['name'])
|
||||||
self.assertEqual(service4.protocol, data['protocol'])
|
self.assertEqual(service4.protocol, data['protocol'])
|
||||||
self.assertEqual(service4.port, data['port'])
|
self.assertEqual(service4.port, data['port'])
|
||||||
|
tags = [tag.name for tag in service4.tags.all()]
|
||||||
|
self.assertEqual(sorted(tags), sorted(data['tags']))
|
||||||
|
|
||||||
def test_create_service_bulk(self):
|
def test_create_service_bulk(self):
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user