mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
more prefetch for IPAddressViewSet
This commit is contained in:
parent
04c731da8f
commit
6895b389e5
@ -23,6 +23,7 @@ from netbox.api.viewsets.mixins import ObjectValidationMixin
|
|||||||
from netbox.config import get_config
|
from netbox.config import get_config
|
||||||
from netbox.constants import ADVISORY_LOCK_KEYS
|
from netbox.constants import ADVISORY_LOCK_KEYS
|
||||||
from utilities.api import get_serializer_for_model
|
from utilities.api import get_serializer_for_model
|
||||||
|
from virtualization.models import VMInterface
|
||||||
from . import serializers
|
from . import serializers
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +107,10 @@ class IPAddressViewSet(NetBoxModelViewSet):
|
|||||||
GenericPrefetch(
|
GenericPrefetch(
|
||||||
"assigned_object",
|
"assigned_object",
|
||||||
[
|
[
|
||||||
Interface.objects.select_related("device"),
|
# serializers are taken according to IPADDRESS_ASSIGNMENT_MODELS
|
||||||
|
FHRPGroup.objects.all(),
|
||||||
|
Interface.objects.select_related("cable", "device"),
|
||||||
|
VMInterface.objects.select_related("virtual_machine"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user