From 0316072863db11ba1a717704c1d492003cb4d900 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 9 Nov 2018 09:54:30 -0500 Subject: [PATCH] Fixes #2574: Remove duplicate interface links from topology maps --- CHANGELOG.md | 1 + netbox/extras/models.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b65c10f7c..6b6a3e732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 * [#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 +* [#2574](https://github.com/digitalocean/netbox/issues/2574) - Remove duplicate interface links from topology maps ## API Changes diff --git a/netbox/extras/models.py b/netbox/extras/models.py index 7bf28d225..1c7dfd17b 100644 --- a/netbox/extras/models.py +++ b/netbox/extras/models.py @@ -8,7 +8,7 @@ from django.contrib.contenttypes.models import ContentType from django.contrib.postgres.fields import JSONField from django.core.validators import ValidationError 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.template import Template, Context from django.urls import reverse @@ -512,6 +512,7 @@ class TopologyMap(models.Model): ).filter( Q(device__in=devices) | Q(_connected_interface__device__in=devices), _connected_interface__isnull=False, + pk__lt=F('_connected_interface') ) for interface in connected_interfaces: style = 'solid' if interface.connection_status == CONNECTION_STATUS_CONNECTED else 'dashed'