mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Retain ip_addresses name for related IPAddress objects
This commit is contained in:
parent
490dee1fa0
commit
40938f0c8a
@ -484,7 +484,7 @@ class PowerOutletViewSet(CableTraceMixin, ModelViewSet):
|
||||
|
||||
class InterfaceViewSet(CableTraceMixin, ModelViewSet):
|
||||
queryset = Interface.objects.prefetch_related(
|
||||
'device', '_connected_interface', '_connected_circuittermination', 'cable', 'ipaddresses', 'tags'
|
||||
'device', '_connected_interface', '_connected_circuittermination', 'cable', 'ip_addresses', 'tags'
|
||||
).filter(
|
||||
device__isnull=False
|
||||
)
|
||||
|
@ -686,7 +686,7 @@ class Interface(CableTermination, ComponentModel, BaseInterface):
|
||||
blank=True,
|
||||
verbose_name='Tagged VLANs'
|
||||
)
|
||||
ipaddresses = GenericRelation(
|
||||
ip_addresses = GenericRelation(
|
||||
to='ipam.IPAddress',
|
||||
content_type_field='assigned_object_type',
|
||||
object_id_field='assigned_object_id'
|
||||
|
@ -1442,7 +1442,7 @@ class InterfaceView(ObjectView):
|
||||
|
||||
# Get assigned IP addresses
|
||||
ipaddress_table = InterfaceIPAddressTable(
|
||||
data=interface.ipaddresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'),
|
||||
data=interface.ip_addresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'),
|
||||
orderable=False
|
||||
)
|
||||
|
||||
|
@ -2,7 +2,7 @@ import netaddr
|
||||
from django.conf import settings
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ValidationError, ObjectDoesNotExist
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.db import models
|
||||
from django.db.models import F
|
||||
|
@ -405,7 +405,7 @@ class Interface(BaseInterface):
|
||||
blank=True,
|
||||
verbose_name='Tagged VLANs'
|
||||
)
|
||||
ipaddresses = GenericRelation(
|
||||
ip_addresses = GenericRelation(
|
||||
to='ipam.IPAddress',
|
||||
content_type_field='assigned_object_type',
|
||||
object_id_field='assigned_object_id'
|
||||
|
@ -306,7 +306,7 @@ class InterfaceView(ObjectView):
|
||||
|
||||
# Get assigned IP addresses
|
||||
ipaddress_table = InterfaceIPAddressTable(
|
||||
data=interface.ipaddresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'),
|
||||
data=interface.ip_addresses.restrict(request.user, 'view').prefetch_related('vrf', 'tenant'),
|
||||
orderable=False
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user