mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Remove "primary for" references to Device on IPAddress
This commit is contained in:
@ -0,0 +1,23 @@
|
|||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('ipam', '0053_asn_model'),
|
||||||
|
('dcim', '0142_rename_128gfc_qsfp28'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='device',
|
||||||
|
name='primary_ip4',
|
||||||
|
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='device',
|
||||||
|
name='primary_ip6',
|
||||||
|
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress'),
|
||||||
|
),
|
||||||
|
]
|
@ -540,7 +540,7 @@ class Device(PrimaryModel, ConfigContextModel):
|
|||||||
primary_ip4 = models.OneToOneField(
|
primary_ip4 = models.OneToOneField(
|
||||||
to='ipam.IPAddress',
|
to='ipam.IPAddress',
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
related_name='primary_ip4_for',
|
related_name='+',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name='Primary IPv4'
|
verbose_name='Primary IPv4'
|
||||||
@ -548,7 +548,7 @@ class Device(PrimaryModel, ConfigContextModel):
|
|||||||
primary_ip6 = models.OneToOneField(
|
primary_ip6 = models.OneToOneField(
|
||||||
to='ipam.IPAddress',
|
to='ipam.IPAddress',
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
related_name='primary_ip6_for',
|
related_name='+',
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name='Primary IPv6'
|
verbose_name='Primary IPv6'
|
||||||
|
@ -523,9 +523,7 @@ class PrefixIPAddressesView(generic.ObjectView):
|
|||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
# Find all IPAddresses belonging to this Prefix
|
# Find all IPAddresses belonging to this Prefix
|
||||||
ipaddresses = instance.get_child_ips().restrict(request.user, 'view').prefetch_related(
|
ipaddresses = instance.get_child_ips().restrict(request.user, 'view').prefetch_related('vrf')
|
||||||
'vrf', 'primary_ip4_for', 'primary_ip6_for'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add available IP addresses to the table if requested
|
# Add available IP addresses to the table if requested
|
||||||
if request.GET.get('show_available', 'true') == 'true':
|
if request.GET.get('show_available', 'true') == 'true':
|
||||||
@ -604,9 +602,7 @@ class IPRangeIPAddressesView(generic.ObjectView):
|
|||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
# Find all IPAddresses within this range
|
# Find all IPAddresses within this range
|
||||||
ipaddresses = instance.get_child_ips().restrict(request.user, 'view').prefetch_related(
|
ipaddresses = instance.get_child_ips().restrict(request.user, 'view').prefetch_related('vrf')
|
||||||
'vrf', 'primary_ip4_for', 'primary_ip6_for'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add available IP addresses to the table if requested
|
# Add available IP addresses to the table if requested
|
||||||
# if request.GET.get('show_available', 'true') == 'true':
|
# if request.GET.get('show_available', 'true') == 'true':
|
||||||
|
Reference in New Issue
Block a user