small cleanup and v0.4.5

This commit is contained in:
Mattijs Vanhaverbeke
2020-05-18 18:52:56 +02:00
parent e50945f8b5
commit 0d7052d83d
4 changed files with 13 additions and 10 deletions
+10 -7
View File
@@ -156,15 +156,18 @@ class SearchViewSet(GenericViewSet):
if dev_name is None:
dev_name = "device name unknown"
cable_role_name = device.device_type.display_name
if cable_role_name is None:
cable_role_name = "device role name unknown"
dev_title = "<table><tr><th>Type:</th><td>" + cable_role_name + "</td></tr><tr><th>Role:</th><td>" + device.device_role.name
node_content = ""
if device.device_type.display_name is not None:
node_content += "<tr><th>Type: </th><td>" + device.device_type.display_name + "</td></tr>"
if device.device_role.name is not None:
node_content += "<tr><th>Role: </th><td>" + device.device_role.name + "</td></tr>"
if device.serial != "":
dev_title = dev_title + "</td></tr><tr><th>Serial:</th><td>" + device.serial
node_content += "<tr><th>Serial: </th><td>" + device.serial + "</td></tr>"
if device.primary_ip is not None:
dev_title = dev_title + "</td></tr><tr><th>IP Address:</th><td>" + str(device.primary_ip.address)
dev_title = dev_title + "</td></tr></table>"
node_content += "<tr><th>IP Address: </th><td>" + str(device.primary_ip.address) + "</td></tr>"
dev_title = "<table> %s </table>" % (node_content)
node = {}
node["id"] = device.id