mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-09 21:32:17 -06:00
Some checks failed
CodeQL / Analyze (python) (push) Has been cancelled
CI / build (20.x, 3.12) (push) Has been cancelled
CI / build (20.x, 3.13) (push) Has been cancelled
CI / build (20.x, 3.14) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
26 lines
960 B
Python
26 lines
960 B
Python
from dcim.models import Manufacturer
|
|
from netbox.api.fields import RelatedObjectCountField
|
|
from netbox.api.serializers import OrganizationalModelSerializer
|
|
|
|
__all__ = (
|
|
'ManufacturerSerializer',
|
|
)
|
|
|
|
|
|
class ManufacturerSerializer(OrganizationalModelSerializer):
|
|
|
|
# Related object counts
|
|
devicetype_count = RelatedObjectCountField('device_types')
|
|
moduletype_count = RelatedObjectCountField('module_types')
|
|
inventoryitem_count = RelatedObjectCountField('inventory_items')
|
|
platform_count = RelatedObjectCountField('platforms')
|
|
|
|
class Meta:
|
|
model = Manufacturer
|
|
fields = [
|
|
'id', 'url', 'display_url', 'display', 'name', 'slug', 'description', 'owner', 'comments', 'tags',
|
|
'custom_fields', 'created', 'last_updated', 'devicetype_count', 'moduletype_count', 'inventoryitem_count',
|
|
'platform_count',
|
|
]
|
|
brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description')
|