mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Closes #5991: Remove display_name attribute from serializers
This commit is contained in:
parent
534b0e4cf6
commit
5856275347
@ -6,3 +6,18 @@
|
|||||||
|
|
||||||
* [#5532](https://github.com/netbox-community/netbox/issues/5532) - Drop support for Python 3.6
|
* [#5532](https://github.com/netbox-community/netbox/issues/5532) - Drop support for Python 3.6
|
||||||
* [#5994](https://github.com/netbox-community/netbox/issues/5994) - Drop support for `display_field` argument on ObjectVar
|
* [#5994](https://github.com/netbox-community/netbox/issues/5994) - Drop support for `display_field` argument on ObjectVar
|
||||||
|
|
||||||
|
### REST API Changes
|
||||||
|
|
||||||
|
* dcim.Device
|
||||||
|
* Removed the `display_name` attribute (use `display` instead)
|
||||||
|
* dcim.DeviceType
|
||||||
|
* Removed the `display_name` attribute (use `display` instead)
|
||||||
|
* dcim.Rack
|
||||||
|
* Removed the `display_name` attribute (use `display` instead)
|
||||||
|
* extras.ContentType
|
||||||
|
* Removed the `display_name` attribute (use `display` instead)
|
||||||
|
* ipam.VLAN
|
||||||
|
* Removed the `display_name` attribute (use `display` instead)
|
||||||
|
* ipam.VRF
|
||||||
|
* Removed the `display_name` attribute (use `display` instead)
|
||||||
|
@ -101,7 +101,7 @@ class NestedRackSerializer(WritableNestedSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Rack
|
model = models.Rack
|
||||||
fields = ['id', 'url', 'display', 'name', 'display_name', 'device_count']
|
fields = ['id', 'url', 'display', 'name', 'device_count']
|
||||||
|
|
||||||
|
|
||||||
class NestedRackReservationSerializer(WritableNestedSerializer):
|
class NestedRackReservationSerializer(WritableNestedSerializer):
|
||||||
@ -136,7 +136,7 @@ class NestedDeviceTypeSerializer(WritableNestedSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.DeviceType
|
model = models.DeviceType
|
||||||
fields = ['id', 'url', 'display', 'manufacturer', 'model', 'slug', 'display_name', 'device_count']
|
fields = ['id', 'url', 'display', 'manufacturer', 'model', 'slug', 'device_count']
|
||||||
|
|
||||||
|
|
||||||
class NestedConsolePortTemplateSerializer(WritableNestedSerializer):
|
class NestedConsolePortTemplateSerializer(WritableNestedSerializer):
|
||||||
@ -232,7 +232,7 @@ class NestedDeviceSerializer(WritableNestedSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Device
|
model = models.Device
|
||||||
fields = ['id', 'url', 'display', 'name', 'display_name']
|
fields = ['id', 'url', 'display', 'name']
|
||||||
|
|
||||||
|
|
||||||
class NestedConsoleServerPortSerializer(WritableNestedSerializer):
|
class NestedConsoleServerPortSerializer(WritableNestedSerializer):
|
||||||
|
@ -172,10 +172,9 @@ class RackSerializer(PrimaryModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Rack
|
model = Rack
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'name', 'facility_id', 'display_name', 'site', 'location', 'tenant', 'status',
|
'id', 'url', 'display', 'name', 'facility_id', 'site', 'location', 'tenant', 'status', 'role', 'serial',
|
||||||
'role', 'serial', 'asset_tag', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
|
'asset_tag', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
|
||||||
'outer_unit', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count',
|
'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', 'powerfeed_count',
|
||||||
'powerfeed_count',
|
|
||||||
]
|
]
|
||||||
# Omit the UniqueTogetherValidator that would be automatically added to validate (location, facility_id). This
|
# Omit the UniqueTogetherValidator that would be automatically added to validate (location, facility_id). This
|
||||||
# prevents facility_id from being interpreted as a required field.
|
# prevents facility_id from being interpreted as a required field.
|
||||||
@ -284,9 +283,9 @@ class DeviceTypeSerializer(PrimaryModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = DeviceType
|
model = DeviceType
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'manufacturer', 'model', 'slug', 'display_name', 'part_number', 'u_height',
|
'id', 'url', 'display', 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth',
|
||||||
'is_full_depth', 'subdevice_role', 'front_image', 'rear_image', 'comments', 'tags', 'custom_fields',
|
'subdevice_role', 'front_image', 'rear_image', 'comments', 'tags', 'custom_fields', 'created',
|
||||||
'created', 'last_updated', 'device_count',
|
'last_updated', 'device_count',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -465,10 +464,10 @@ class DeviceSerializer(PrimaryModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Device
|
model = Device
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'name', 'display_name', 'device_type', 'device_role', 'tenant', 'platform',
|
'id', 'url', 'display', 'name', 'device_type', 'device_role', 'tenant', 'platform', 'serial', 'asset_tag',
|
||||||
'serial', 'asset_tag', 'site', 'location', 'rack', 'position', 'face', 'parent_device', 'status',
|
'site', 'location', 'rack', 'position', 'face', 'parent_device', 'status', 'primary_ip', 'primary_ip4',
|
||||||
'primary_ip', 'primary_ip4', 'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority',
|
'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority', 'comments', 'local_context_data',
|
||||||
'comments', 'local_context_data', 'tags', 'custom_fields', 'created', 'last_updated',
|
'tags', 'custom_fields', 'created', 'last_updated',
|
||||||
]
|
]
|
||||||
validators = []
|
validators = []
|
||||||
|
|
||||||
@ -501,10 +500,10 @@ class DeviceWithConfigContextSerializer(DeviceSerializer):
|
|||||||
|
|
||||||
class Meta(DeviceSerializer.Meta):
|
class Meta(DeviceSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'name', 'display_name', 'device_type', 'device_role', 'tenant', 'platform',
|
'id', 'url', 'display', 'name', 'device_type', 'device_role', 'tenant', 'platform', 'serial', 'asset_tag',
|
||||||
'serial', 'asset_tag', 'site', 'location', 'rack', 'position', 'face', 'parent_device', 'status',
|
'site', 'location', 'rack', 'position', 'face', 'parent_device', 'status', 'primary_ip', 'primary_ip4',
|
||||||
'primary_ip', 'primary_ip4', 'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority',
|
'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority', 'comments', 'local_context_data',
|
||||||
'comments', 'local_context_data', 'tags', 'custom_fields', 'config_context', 'created', 'last_updated',
|
'tags', 'custom_fields', 'config_context', 'created', 'last_updated',
|
||||||
]
|
]
|
||||||
|
|
||||||
@swagger_serializer_method(serializer_or_field=serializers.DictField)
|
@swagger_serializer_method(serializer_or_field=serializers.DictField)
|
||||||
|
@ -251,7 +251,7 @@ class RackRoleTest(APIViewTestCases.APIViewTestCase):
|
|||||||
|
|
||||||
class RackTest(APIViewTestCases.APIViewTestCase):
|
class RackTest(APIViewTestCases.APIViewTestCase):
|
||||||
model = Rack
|
model = Rack
|
||||||
brief_fields = ['device_count', 'display', 'display_name', 'id', 'name', 'url']
|
brief_fields = ['device_count', 'display', 'id', 'name', 'url']
|
||||||
bulk_update_data = {
|
bulk_update_data = {
|
||||||
'status': 'planned',
|
'status': 'planned',
|
||||||
}
|
}
|
||||||
@ -422,7 +422,7 @@ class ManufacturerTest(APIViewTestCases.APIViewTestCase):
|
|||||||
|
|
||||||
class DeviceTypeTest(APIViewTestCases.APIViewTestCase):
|
class DeviceTypeTest(APIViewTestCases.APIViewTestCase):
|
||||||
model = DeviceType
|
model = DeviceType
|
||||||
brief_fields = ['device_count', 'display', 'display_name', 'id', 'manufacturer', 'model', 'slug', 'url']
|
brief_fields = ['device_count', 'display', 'id', 'manufacturer', 'model', 'slug', 'url']
|
||||||
bulk_update_data = {
|
bulk_update_data = {
|
||||||
'part_number': 'ABC123',
|
'part_number': 'ABC123',
|
||||||
}
|
}
|
||||||
@ -870,7 +870,7 @@ class PlatformTest(APIViewTestCases.APIViewTestCase):
|
|||||||
|
|
||||||
class DeviceTest(APIViewTestCases.APIViewTestCase):
|
class DeviceTest(APIViewTestCases.APIViewTestCase):
|
||||||
model = Device
|
model = Device
|
||||||
brief_fields = ['display', 'display_name', 'id', 'name', 'url']
|
brief_fields = ['display', 'id', 'name', 'url']
|
||||||
bulk_update_data = {
|
bulk_update_data = {
|
||||||
'status': 'failed',
|
'status': 'failed',
|
||||||
}
|
}
|
||||||
|
@ -453,12 +453,7 @@ class ObjectChangeSerializer(BaseModelSerializer):
|
|||||||
|
|
||||||
class ContentTypeSerializer(BaseModelSerializer):
|
class ContentTypeSerializer(BaseModelSerializer):
|
||||||
url = serializers.HyperlinkedIdentityField(view_name='extras-api:contenttype-detail')
|
url = serializers.HyperlinkedIdentityField(view_name='extras-api:contenttype-detail')
|
||||||
display_name = serializers.SerializerMethodField()
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ContentType
|
model = ContentType
|
||||||
fields = ['id', 'url', 'display', 'app_label', 'model', 'display_name']
|
fields = ['id', 'url', 'display', 'app_label', 'model']
|
||||||
|
|
||||||
@swagger_serializer_method(serializer_or_field=serializers.CharField)
|
|
||||||
def get_display_name(self, obj):
|
|
||||||
return obj.app_labeled_name
|
|
||||||
|
@ -27,7 +27,7 @@ class NestedVRFSerializer(WritableNestedSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.VRF
|
model = models.VRF
|
||||||
fields = ['id', 'url', 'display', 'name', 'rd', 'display_name', 'prefix_count']
|
fields = ['id', 'url', 'display', 'name', 'rd', 'prefix_count']
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -92,7 +92,7 @@ class NestedVLANSerializer(WritableNestedSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.VLAN
|
model = models.VLAN
|
||||||
fields = ['id', 'url', 'display', 'vid', 'name', 'display_name']
|
fields = ['id', 'url', 'display', 'vid', 'name']
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -44,8 +44,7 @@ class VRFSerializer(PrimaryModelSerializer):
|
|||||||
model = VRF
|
model = VRF
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'name', 'rd', 'tenant', 'enforce_unique', 'description', 'import_targets',
|
'id', 'url', 'display', 'name', 'rd', 'tenant', 'enforce_unique', 'description', 'import_targets',
|
||||||
'export_targets', 'tags', 'display_name', 'custom_fields', 'created', 'last_updated', 'ipaddress_count',
|
'export_targets', 'tags', 'custom_fields', 'created', 'last_updated', 'ipaddress_count', 'prefix_count',
|
||||||
'prefix_count',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +166,7 @@ class VLANSerializer(PrimaryModelSerializer):
|
|||||||
model = VLAN
|
model = VLAN
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'tags',
|
'id', 'url', 'display', 'site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'tags',
|
||||||
'display_name', 'custom_fields', 'created', 'last_updated', 'prefix_count',
|
'custom_fields', 'created', 'last_updated', 'prefix_count',
|
||||||
]
|
]
|
||||||
validators = []
|
validators = []
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class AppTest(APITestCase):
|
|||||||
|
|
||||||
class VRFTest(APIViewTestCases.APIViewTestCase):
|
class VRFTest(APIViewTestCases.APIViewTestCase):
|
||||||
model = VRF
|
model = VRF
|
||||||
brief_fields = ['display', 'display_name', 'id', 'name', 'prefix_count', 'rd', 'url']
|
brief_fields = ['display', 'id', 'name', 'prefix_count', 'rd', 'url']
|
||||||
create_data = [
|
create_data = [
|
||||||
{
|
{
|
||||||
'name': 'VRF 4',
|
'name': 'VRF 4',
|
||||||
@ -421,7 +421,7 @@ class VLANGroupTest(APIViewTestCases.APIViewTestCase):
|
|||||||
|
|
||||||
class VLANTest(APIViewTestCases.APIViewTestCase):
|
class VLANTest(APIViewTestCases.APIViewTestCase):
|
||||||
model = VLAN
|
model = VLAN
|
||||||
brief_fields = ['display', 'display_name', 'id', 'name', 'url', 'vid']
|
brief_fields = ['display', 'id', 'name', 'url', 'vid']
|
||||||
bulk_update_data = {
|
bulk_update_data = {
|
||||||
'description': 'New description',
|
'description': 'New description',
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user