Skip to content

Commit

Permalink
fix power feeds attributeerror (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreng authored Mar 30, 2024
1 parent bd32642 commit 32003e5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions netbox_topology_views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ def create_node(

node["id"] = device.pk

if device.site is not None:
node["site"] = device.site.name
node["site_id"] = device.site_id
if device.location is not None:
node["location"] = device.location.name
node["location_id"] = device.location_id
if device.rack is not None:
node["rack"] = device.rack.name
node["rack_id"] = device.rack_id

if device.device_role.color != "":
node["color.border"] = "#" + device.device_role.color

Expand Down Expand Up @@ -220,15 +230,6 @@ def create_node(
node["shape"] = "image"
node["href"] = device.get_absolute_url()
node["image"] = get_image_for_entity(device)
if device.site is not None:
node["site"] = device.site.name
node["site_id"] = device.site_id
if device.location is not None:
node["location"] = device.location.name
node["location_id"] = device.location_id
if device.rack is not None:
node["rack"] = device.rack.name
node["rack_id"] = device.rack_id

return node

Expand Down

0 comments on commit 32003e5

Please sign in to comment.