class WritableSiteSerializer(CustomFieldModelSerializer):
    time_zone = TimeZoneField(required=False, allow_null=True)

    class Meta:
        model = Site
        fields = [
            'id',
            'name',
            'slug',
            'status',
            'region',
            'tenant',
            'facility',
            'asn',
            'time_zone',
            'description',
            'physical_address',
            'shipping_address',
            'contact_name',
            'contact_phone',
            'contact_email',
            'comments',
            'custom_fields',
            'created',
            'last_updated',
        ]
예제 #2
0
class SiteSerializer(CustomFieldModelSerializer):
    region = NestedRegionSerializer()
    tenant = NestedTenantSerializer()
    time_zone = TimeZoneField(required=False)

    class Meta:
        model = Site
        fields = [
            'id',
            'name',
            'slug',
            'region',
            'tenant',
            'facility',
            'asn',
            'time_zone',
            'physical_address',
            'shipping_address',
            'contact_name',
            'contact_phone',
            'contact_email',
            'comments',
            'custom_fields',
            'created',
            'last_updated',
            'count_prefixes',
            'count_vlans',
            'count_racks',
            'count_devices',
            'count_circuits',
        ]
예제 #3
0
class SiteSerializer(TaggitSerializer, CustomFieldModelSerializer):
    status = ChoiceField(choices=SITE_STATUS_CHOICES, required=False)
    region = NestedRegionSerializer(required=False, allow_null=True)
    tenant = NestedTenantSerializer(required=False, allow_null=True)
    time_zone = TimeZoneField(required=False)
    tags = TagListSerializerField(required=False)

    class Meta:
        model = Site
        fields = [
            'id', 'name', 'slug', 'status', 'region', 'tenant', 'facility', 'asn', 'time_zone', 'description',
            'physical_address', 'shipping_address', 'latitude', 'longitude', 'contact_name', 'contact_phone',
            'contact_email', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'count_prefixes',
            'count_vlans', 'count_racks', 'count_devices', 'count_circuits',
        ]
예제 #4
0
class SiteSerializer(TaggedObjectSerializer, CustomFieldModelSerializer):
    url = serializers.HyperlinkedIdentityField(
        view_name='dcim-api:site-detail')
    status = ChoiceField(choices=SiteStatusChoices, required=False)
    region = NestedRegionSerializer(required=False, allow_null=True)
    tenant = NestedTenantSerializer(required=False, allow_null=True)
    time_zone = TimeZoneField(required=False)
    circuit_count = serializers.IntegerField(read_only=True)
    device_count = serializers.IntegerField(read_only=True)
    prefix_count = serializers.IntegerField(read_only=True)
    rack_count = serializers.IntegerField(read_only=True)
    virtualmachine_count = serializers.IntegerField(read_only=True)
    vlan_count = serializers.IntegerField(read_only=True)

    class Meta:
        model = Site
        fields = [
            'id',
            'url',
            'name',
            'slug',
            'status',
            'region',
            'tenant',
            'facility',
            'asn',
            'time_zone',
            'description',
            'physical_address',
            'shipping_address',
            'latitude',
            'longitude',
            'contact_name',
            'contact_phone',
            'contact_email',
            'comments',
            'tags',
            'custom_fields',
            'created',
            'last_updated',
            'circuit_count',
            'device_count',
            'prefix_count',
            'rack_count',
            'virtualmachine_count',
            'vlan_count',
        ]