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.
This commit is contained in:
Anthony Ruhier 2019-03-05 18:44:44 +01:00
parent 0c142f2078
commit bd65e782bb
No known key found for this signature in database
GPG Key ID: 73E9C8657EC59E3A

View File

@ -507,7 +507,7 @@ class CableSerializer(ValidatedModelSerializer):
termination_a = serializers.SerializerMethodField(read_only=True) termination_a = serializers.SerializerMethodField(read_only=True)
termination_b = serializers.SerializerMethodField(read_only=True) termination_b = serializers.SerializerMethodField(read_only=True)
status = ChoiceField(choices=CONNECTION_STATUS_CHOICES, required=False) 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: class Meta:
model = Cable model = Cable