Fixes #2574: Remove duplicate interface links from topology maps

This commit is contained in:
Jeremy Stretch 2018-11-09 09:54:30 -05:00
parent be5bf6b711
commit 0316072863
2 changed files with 3 additions and 1 deletions

View File

@ -47,6 +47,7 @@ NetBox now supports modeling physical cables for console, power, and interface c
* [#2571](https://github.com/digitalocean/netbox/issues/2571) - Enforce deletion of attached cable when deleting a termination point * [#2571](https://github.com/digitalocean/netbox/issues/2571) - Enforce deletion of attached cable when deleting a termination point
* [#2572](https://github.com/digitalocean/netbox/issues/2572) - Add button to disconnect cable from circuit termination * [#2572](https://github.com/digitalocean/netbox/issues/2572) - Add button to disconnect cable from circuit termination
* [#2573](https://github.com/digitalocean/netbox/issues/2573) - Fix bulk console/power/interface disconnections * [#2573](https://github.com/digitalocean/netbox/issues/2573) - Fix bulk console/power/interface disconnections
* [#2574](https://github.com/digitalocean/netbox/issues/2574) - Remove duplicate interface links from topology maps
## API Changes ## API Changes

View File

@ -8,7 +8,7 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import JSONField from django.contrib.postgres.fields import JSONField
from django.core.validators import ValidationError from django.core.validators import ValidationError
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import F, Q
from django.http import HttpResponse from django.http import HttpResponse
from django.template import Template, Context from django.template import Template, Context
from django.urls import reverse from django.urls import reverse
@ -512,6 +512,7 @@ class TopologyMap(models.Model):
).filter( ).filter(
Q(device__in=devices) | Q(_connected_interface__device__in=devices), Q(device__in=devices) | Q(_connected_interface__device__in=devices),
_connected_interface__isnull=False, _connected_interface__isnull=False,
pk__lt=F('_connected_interface')
) )
for interface in connected_interfaces: for interface in connected_interfaces:
style = 'solid' if interface.connection_status == CONNECTION_STATUS_CONNECTED else 'dashed' style = 'solid' if interface.connection_status == CONNECTION_STATUS_CONNECTED else 'dashed'