Explorar o código

Allow nullable length unit in cable API

Cables models define it as None by default, but the API rejects a
request containing a null length_unit. Allows it in the API
serializer.
Anthony Ruhier %!s(int64=7) %!d(string=hai) anos
pai
achega
bd65e782bb
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      netbox/dcim/api/serializers.py

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

@@ -507,7 +507,7 @@ class CableSerializer(ValidatedModelSerializer):
     termination_a = serializers.SerializerMethodField(read_only=True)
     termination_b = serializers.SerializerMethodField(read_only=True)
     status = ChoiceField(choices=CONNECTION_STATUS_CHOICES, required=False)
-    length_unit = ChoiceField(choices=CABLE_LENGTH_UNIT_CHOICES, required=False)
+    length_unit = ChoiceField(choices=CABLE_LENGTH_UNIT_CHOICES, required=False, allow_null=True)
 
     class Meta:
         model = Cable