Procházet zdrojové kódy

Fixes #2574: Remove duplicate interface links from topology maps

Jeremy Stretch před 7 roky
rodič
revize
0316072863
2 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 1 0
      CHANGELOG.md
  2. 2 1
      netbox/extras/models.py

+ 1 - 0
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
 

+ 2 - 1
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'