Explorar o código

Fixes #10147: Permit the creation of 0U device types via REST API

jeremystretch %!s(int64=3) %!d(string=hai) anos
pai
achega
482b4b6e95

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

@@ -27,6 +27,7 @@
 * [#10109](https://github.com/netbox-community/netbox/issues/10109) - Fix available prefixes calculation for container prefixes in the global table
 * [#10111](https://github.com/netbox-community/netbox/issues/10111) - Wrap search QS to catch ValueError on identifier field
 * [#10134](https://github.com/netbox-community/netbox/issues/10134) - Custom fields data serializer should return a 400 response for invalid data
+* [#10147](https://github.com/netbox-community/netbox/issues/10147) - Permit the creation of 0U device types via REST API
 
 ---
 

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

@@ -310,7 +310,7 @@ class DeviceTypeSerializer(NetBoxModelSerializer):
         max_digits=4,
         decimal_places=1,
         label='Position (U)',
-        min_value=decimal.Decimal(0.5),
+        min_value=0,
         default=1.0
     )
     subdevice_role = ChoiceField(choices=SubdeviceRoleChoices, allow_blank=True, required=False)

+ 3 - 0
netbox/dcim/tests/test_api.py

@@ -461,16 +461,19 @@ class DeviceTypeTest(APIViewTestCases.APIViewTestCase):
                 'manufacturer': manufacturers[1].pk,
                 'model': 'Device Type 4',
                 'slug': 'device-type-4',
+                'u_height': 0,
             },
             {
                 'manufacturer': manufacturers[1].pk,
                 'model': 'Device Type 5',
                 'slug': 'device-type-5',
+                'u_height': 0.5,
             },
             {
                 'manufacturer': manufacturers[1].pk,
                 'model': 'Device Type 6',
                 'slug': 'device-type-6',
+                'u_height': 1,
             },
         ]