Retain ip_addresses name for related IPAddress objects

This commit is contained in:
Jeremy Stretch 2020-06-22 16:13:18 -04:00
parent 490dee1fa0
commit 40938f0c8a
6 changed files with 6 additions and 6 deletions

View File

@ -484,7 +484,7 @@ class PowerOutletViewSet(CableTraceMixin, ModelViewSet):
class InterfaceViewSet(CableTraceMixin, ModelViewSet): class InterfaceViewSet(CableTraceMixin, ModelViewSet):
queryset = Interface.objects.prefetch_related( queryset = Interface.objects.prefetch_related(
'device', '_connected_interface', '_connected_circuittermination', 'cable', 'ipaddresses', 'tags' 'device', '_connected_interface', '_connected_circuittermination', 'cable', 'ip_addresses', 'tags'
).filter( ).filter(
device__isnull=False device__isnull=False
) )

View File

@ -686,7 +686,7 @@ class Interface(CableTermination, ComponentModel, BaseInterface):
blank=True, blank=True,
verbose_name='Tagged VLANs' verbose_name='Tagged VLANs'
) )
ipaddresses = GenericRelation( ip_addresses = GenericRelation(
to='ipam.IPAddress', to='ipam.IPAddress',
content_type_field='assigned_object_type', content_type_field='assigned_object_type',
object_id_field='assigned_object_id' object_id_field='assigned_object_id'

View File

@ -1442,7 +1442,7 @@ class InterfaceView(ObjectView):
# Get assigned IP addresses # Get assigned IP addresses
ipaddress_table = InterfaceIPAddressTable( 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 orderable=False
) )

View File

@ -2,7 +2,7 @@ import netaddr
from django.conf import settings from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType 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.core.validators import MaxValueValidator, MinValueValidator
from django.db import models from django.db import models
from django.db.models import F from django.db.models import F

View File

@ -405,7 +405,7 @@ class Interface(BaseInterface):
blank=True, blank=True,
verbose_name='Tagged VLANs' verbose_name='Tagged VLANs'
) )
ipaddresses = GenericRelation( ip_addresses = GenericRelation(
to='ipam.IPAddress', to='ipam.IPAddress',
content_type_field='assigned_object_type', content_type_field='assigned_object_type',
object_id_field='assigned_object_id' object_id_field='assigned_object_id'

View File

@ -306,7 +306,7 @@ class InterfaceView(ObjectView):
# Get assigned IP addresses # Get assigned IP addresses
ipaddress_table = InterfaceIPAddressTable( 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 orderable=False
) )