mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 17:26:10 -06:00
9608 fix choices default
This commit is contained in:
parent
7369c772c4
commit
7120a0384c
@ -644,7 +644,7 @@ class DeviceSerializer(NetBoxModelSerializer):
|
|||||||
site = NestedSiteSerializer()
|
site = NestedSiteSerializer()
|
||||||
location = NestedLocationSerializer(required=False, allow_null=True, default=None)
|
location = NestedLocationSerializer(required=False, allow_null=True, default=None)
|
||||||
rack = NestedRackSerializer(required=False, allow_null=True, default=None)
|
rack = NestedRackSerializer(required=False, allow_null=True, default=None)
|
||||||
face = ChoiceField(choices=DeviceFaceChoices, allow_blank=True, default='')
|
face = ChoiceField(choices=DeviceFaceChoices, allow_blank=True, default=lambda: '')
|
||||||
position = serializers.DecimalField(
|
position = serializers.DecimalField(
|
||||||
max_digits=4,
|
max_digits=4,
|
||||||
decimal_places=1,
|
decimal_places=1,
|
||||||
@ -1168,15 +1168,19 @@ class PowerFeedSerializer(NetBoxModelSerializer, CabledObjectSerializer, Connect
|
|||||||
)
|
)
|
||||||
type = ChoiceField(
|
type = ChoiceField(
|
||||||
choices=PowerFeedTypeChoices,
|
choices=PowerFeedTypeChoices,
|
||||||
|
default=lambda: PowerFeedTypeChoices.TYPE_PRIMARY,
|
||||||
)
|
)
|
||||||
status = ChoiceField(
|
status = ChoiceField(
|
||||||
choices=PowerFeedStatusChoices,
|
choices=PowerFeedStatusChoices,
|
||||||
|
default=lambda: PowerFeedStatusChoices.STATUS_ACTIVE,
|
||||||
)
|
)
|
||||||
supply = ChoiceField(
|
supply = ChoiceField(
|
||||||
choices=PowerFeedSupplyChoices,
|
choices=PowerFeedSupplyChoices,
|
||||||
|
default=lambda: PowerFeedSupplyChoices.SUPPLY_AC,
|
||||||
)
|
)
|
||||||
phase = ChoiceField(
|
phase = ChoiceField(
|
||||||
choices=PowerFeedPhaseChoices,
|
choices=PowerFeedPhaseChoices,
|
||||||
|
default=lambda: PowerFeedPhaseChoices.PHASE_SINGLE,
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -99,7 +99,7 @@ class ContactAssignmentSerializer(NetBoxModelSerializer):
|
|||||||
object = serializers.SerializerMethodField(read_only=True)
|
object = serializers.SerializerMethodField(read_only=True)
|
||||||
contact = NestedContactSerializer()
|
contact = NestedContactSerializer()
|
||||||
role = NestedContactRoleSerializer(required=False, allow_null=True)
|
role = NestedContactRoleSerializer(required=False, allow_null=True)
|
||||||
priority = extend_schema_field(OpenApiTypes.STR)(ChoiceField(choices=ContactPriorityChoices, allow_blank=True, required=False, default=''))
|
priority = ChoiceField(choices=ContactPriorityChoices, allow_blank=True, required=False, default=lambda: '')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ContactAssignment
|
model = ContactAssignment
|
||||||
|
Loading…
Reference in New Issue
Block a user