Fixed interface connection rendering

This commit is contained in:
Jeremy Stretch 2018-10-24 15:07:11 -04:00
parent cca44d44f7
commit 47c523a40b
2 changed files with 4 additions and 4 deletions

View File

@ -1662,7 +1662,7 @@ class InterfaceView(View):
interface = get_object_or_404(Interface, pk=pk) interface = get_object_or_404(Interface, pk=pk)
# Get connected interface # Get connected interface
connected_interface = interface.connected_interface connected_interface = interface.connected_endpoint
if connected_interface is None and hasattr(interface, 'circuit_termination'): if connected_interface is None and hasattr(interface, 'circuit_termination'):
peer_termination = interface.circuit_termination.get_peer_termination() peer_termination = interface.circuit_termination.get_peer_termination()
if peer_termination is not None: if peer_termination is not None:

View File

@ -1,4 +1,4 @@
<tr class="interface{% if not iface.enabled %} danger{% elif iface.connection and iface.connection.connection_status or iface.circuit_termination %} success{% elif iface.connection and not iface.connection.connection_status %} info{% elif iface.is_virtual %} warning{% endif %}" id="iface_{{ iface.name }}"> <tr class="interface{% if not iface.enabled %} danger{% elif iface.connected_endpoint %} {% if iface.connection_status %}success{% else %}info{% endif %}{% elif iface.circuit_termination %} success{% elif iface.is_virtual %} warning{% endif %}" id="iface_{{ iface.name }}">
{# Checkbox #} {# Checkbox #}
{% if perms.dcim.change_interface or perms.dcim.delete_interface %} {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
@ -38,8 +38,8 @@
<td colspan="2" class="text-muted">Virtual interface</td> <td colspan="2" class="text-muted">Virtual interface</td>
{% elif iface.is_wireless %} {% elif iface.is_wireless %}
<td colspan="2" class="text-muted">Wireless interface</td> <td colspan="2" class="text-muted">Wireless interface</td>
{% elif iface.connection %} {% elif iface.connected_endpoint %}
{% with iface.connected_interface as connected_iface %} {% with connected_iface=iface.connected_endpoint %}
<td> <td>
<a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a> <a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
</td> </td>