mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-10 22:02:17 -06:00
Some checks failed
CI / build (20.x, 3.12) (push) Has been cancelled
CI / build (20.x, 3.13) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
26 lines
894 B
Python
26 lines
894 B
Python
from rest_framework import serializers
|
|
|
|
from dcim.models import VirtualChassis
|
|
from netbox.api.serializers import PrimaryModelSerializer
|
|
from .nested import NestedDeviceSerializer
|
|
|
|
__all__ = (
|
|
'VirtualChassisSerializer',
|
|
)
|
|
|
|
|
|
class VirtualChassisSerializer(PrimaryModelSerializer):
|
|
master = NestedDeviceSerializer(required=False, allow_null=True, default=None)
|
|
members = NestedDeviceSerializer(many=True, read_only=True)
|
|
|
|
# Counter fields
|
|
member_count = serializers.IntegerField(read_only=True)
|
|
|
|
class Meta:
|
|
model = VirtualChassis
|
|
fields = [
|
|
'id', 'url', 'display_url', 'display', 'name', 'domain', 'master', 'description', 'owner', 'comments',
|
|
'tags', 'custom_fields', 'created', 'last_updated', 'member_count', 'members',
|
|
]
|
|
brief_fields = ('id', 'url', 'display', 'name', 'master', 'description', 'member_count')
|