Просмотр исходного кода

Fixes #4950: Include inventory item label in API serializer, UI view

Jeremy Stretch 5 лет назад
Родитель
Сommit
e6df6dc7f4

+ 1 - 0
docs/release-notes/version-2.9.md

@@ -17,6 +17,7 @@
 * [#4931](https://github.com/netbox-community/netbox/issues/4931) - Fix DoesNotExist exception when deleting devices
 * [#4938](https://github.com/netbox-community/netbox/issues/4938) - Show add, import buttons on virtual chassis list view
 * [#4939](https://github.com/netbox-community/netbox/issues/4939) - Fix linking to LAG interfaces on other VC members
+* [#4950](https://github.com/netbox-community/netbox/issues/4950) - Include inventory item label in API serializer, UI view
 * [#4952](https://github.com/netbox-community/netbox/issues/4952) - Default to VM tab when creating/editing an IP address for a VM
 
 ### Other Changes

+ 2 - 2
netbox/dcim/api/serializers.py

@@ -640,8 +640,8 @@ class InventoryItemSerializer(TaggedObjectSerializer, ValidatedModelSerializer):
     class Meta:
         model = InventoryItem
         fields = [
-            'id', 'url', 'device', 'parent', 'name', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'discovered',
-            'description', 'tags',
+            'id', 'url', 'device', 'parent', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag',
+            'discovered', 'description', 'tags',
         ]
 
 

+ 4 - 0
netbox/templates/dcim/inventoryitem.html

@@ -30,6 +30,10 @@
                         <td>Name</td>
                         <td>{{ instance.name }}</td>
                     </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
                     <tr>
                         <td>Manufacturer</td>
                         <td>