mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Added cluster groups and clusters to serializers
This commit is contained in:
parent
4abd3866ab
commit
8849f4b0a5
@ -20,6 +20,8 @@ from utilities.api import (
|
|||||||
ChoiceField, ContentTypeField, get_serializer_for_model, SerializerNotFound, SerializedPKRelatedField,
|
ChoiceField, ContentTypeField, get_serializer_for_model, SerializerNotFound, SerializedPKRelatedField,
|
||||||
ValidatedModelSerializer,
|
ValidatedModelSerializer,
|
||||||
)
|
)
|
||||||
|
from virtualization.api.nested_serializers import NestedClusterGroupSerializer, NestedClusterSerializer
|
||||||
|
from virtualization.models import Cluster, ClusterGroup
|
||||||
from .nested_serializers import *
|
from .nested_serializers import *
|
||||||
|
|
||||||
|
|
||||||
@ -161,6 +163,18 @@ class ConfigContextSerializer(ValidatedModelSerializer):
|
|||||||
required=False,
|
required=False,
|
||||||
many=True
|
many=True
|
||||||
)
|
)
|
||||||
|
cluster_groups = SerializedPKRelatedField(
|
||||||
|
queryset=ClusterGroup.objects.all(),
|
||||||
|
serializer=NestedClusterGroupSerializer,
|
||||||
|
required=False,
|
||||||
|
many=True
|
||||||
|
)
|
||||||
|
clusters = SerializedPKRelatedField(
|
||||||
|
queryset=Cluster.objects.all(),
|
||||||
|
serializer=NestedClusterSerializer,
|
||||||
|
required=False,
|
||||||
|
many=True
|
||||||
|
)
|
||||||
tenant_groups = SerializedPKRelatedField(
|
tenant_groups = SerializedPKRelatedField(
|
||||||
queryset=TenantGroup.objects.all(),
|
queryset=TenantGroup.objects.all(),
|
||||||
serializer=NestedTenantGroupSerializer,
|
serializer=NestedTenantGroupSerializer,
|
||||||
@ -184,7 +198,7 @@ class ConfigContextSerializer(ValidatedModelSerializer):
|
|||||||
model = ConfigContext
|
model = ConfigContext
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'name', 'weight', 'description', 'is_active', 'regions', 'sites', 'roles', 'platforms',
|
'id', 'name', 'weight', 'description', 'is_active', 'regions', 'sites', 'roles', 'platforms',
|
||||||
'tenant_groups', 'tenants', 'tags', 'data',
|
'cluster_groups', 'clusters', 'tenant_groups', 'tenants', 'tags', 'data',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user