mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add tags to organizational & nested group models
This commit is contained in:
@@ -9,7 +9,6 @@ from ipam.choices import *
|
||||
from ipam.constants import IPADDRESS_ASSIGNMENT_MODELS, VLANGROUP_SCOPE_TYPES
|
||||
from ipam.models import *
|
||||
from netbox.api import ChoiceField, ContentTypeField, SerializedPKRelatedField
|
||||
from netbox.api.serializers import OrganizationalModelSerializer
|
||||
from netbox.api.serializers import PrimaryModelSerializer
|
||||
from tenancy.api.nested_serializers import NestedTenantSerializer
|
||||
from utilities.api import get_serializer_for_model
|
||||
@@ -66,14 +65,14 @@ class RouteTargetSerializer(PrimaryModelSerializer):
|
||||
# RIRs/aggregates
|
||||
#
|
||||
|
||||
class RIRSerializer(OrganizationalModelSerializer):
|
||||
class RIRSerializer(PrimaryModelSerializer):
|
||||
url = serializers.HyperlinkedIdentityField(view_name='ipam-api:rir-detail')
|
||||
aggregate_count = serializers.IntegerField(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = RIR
|
||||
fields = [
|
||||
'id', 'url', 'display', 'name', 'slug', 'is_private', 'description', 'custom_fields', 'created',
|
||||
'id', 'url', 'display', 'name', 'slug', 'is_private', 'description', 'tags', 'custom_fields', 'created',
|
||||
'last_updated', 'aggregate_count',
|
||||
]
|
||||
|
||||
@@ -97,7 +96,7 @@ class AggregateSerializer(PrimaryModelSerializer):
|
||||
# VLANs
|
||||
#
|
||||
|
||||
class RoleSerializer(OrganizationalModelSerializer):
|
||||
class RoleSerializer(PrimaryModelSerializer):
|
||||
url = serializers.HyperlinkedIdentityField(view_name='ipam-api:role-detail')
|
||||
prefix_count = serializers.IntegerField(read_only=True)
|
||||
vlan_count = serializers.IntegerField(read_only=True)
|
||||
@@ -105,12 +104,12 @@ class RoleSerializer(OrganizationalModelSerializer):
|
||||
class Meta:
|
||||
model = Role
|
||||
fields = [
|
||||
'id', 'url', 'display', 'name', 'slug', 'weight', 'description', 'custom_fields', 'created', 'last_updated',
|
||||
'prefix_count', 'vlan_count',
|
||||
'id', 'url', 'display', 'name', 'slug', 'weight', 'description', 'tags', 'custom_fields', 'created',
|
||||
'last_updated', 'prefix_count', 'vlan_count',
|
||||
]
|
||||
|
||||
|
||||
class VLANGroupSerializer(OrganizationalModelSerializer):
|
||||
class VLANGroupSerializer(PrimaryModelSerializer):
|
||||
url = serializers.HyperlinkedIdentityField(view_name='ipam-api:vlangroup-detail')
|
||||
scope_type = ContentTypeField(
|
||||
queryset=ContentType.objects.filter(
|
||||
@@ -126,8 +125,8 @@ class VLANGroupSerializer(OrganizationalModelSerializer):
|
||||
class Meta:
|
||||
model = VLANGroup
|
||||
fields = [
|
||||
'id', 'url', 'display', 'name', 'slug', 'scope_type', 'scope_id', 'scope', 'description', 'custom_fields',
|
||||
'created', 'last_updated', 'vlan_count',
|
||||
'id', 'url', 'display', 'name', 'slug', 'scope_type', 'scope_id', 'scope', 'description', 'tags',
|
||||
'custom_fields', 'created', 'last_updated', 'vlan_count',
|
||||
]
|
||||
validators = []
|
||||
|
||||
|
Reference in New Issue
Block a user