Device |
-
- {{ object.device }}
- |
+ {{ object.device|linkify }} |
Module |
-
- {% if object.module %}
- {{ object.module }}
- {% else %}
- {{ None|placeholder }}
- {% endif %}
- |
+ {{ object.module|linkify|placeholder }} |
Name |
@@ -80,7 +72,7 @@
Cable |
- {{ object.cable }}
+ {{ object.cable|linkify }}
@@ -89,15 +81,11 @@
{% if object.connected_endpoint %}
|
Device |
-
- {{ object.connected_endpoint.device }}
- |
+ {{ object.connected_endpoint.device|linkify }} |
Name |
-
- {{ object.connected_endpoint.name }}
- |
+ {{ object.connected_endpoint|linkify:"name" }} |
Type |
diff --git a/netbox/templates/dcim/powerpanel.html b/netbox/templates/dcim/powerpanel.html
index 02db0e56f..b7fe8eb39 100644
--- a/netbox/templates/dcim/powerpanel.html
+++ b/netbox/templates/dcim/powerpanel.html
@@ -7,7 +7,7 @@
{{ block.super }}
{{ object.site }}
{% if object.location %}
- {{ object.location }}
+ {{ object.location|linkify }}
{% endif %}
{% endblock %}
@@ -22,19 +22,11 @@
Site |
-
- {{ object.site }}
- |
+ {{ object.site|linkify }} |
Location |
-
- {% if object.location %}
- {{ object.location }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.location|linkify|placeholder }} |
diff --git a/netbox/templates/dcim/powerport.html b/netbox/templates/dcim/powerport.html
index f82eb1444..6dc06f528 100644
--- a/netbox/templates/dcim/powerport.html
+++ b/netbox/templates/dcim/powerport.html
@@ -20,19 +20,11 @@
Device |
-
- {{ object.device }}
- |
+ {{ object.device|linkify }} |
Module |
-
- {% if object.module %}
- {{ object.module }}
- {% else %}
- {{ None|placeholder }}
- {% endif %}
- |
+ {{ object.module|linkify|placeholder }} |
Name |
@@ -80,7 +72,7 @@
Cable |
- {{ object.cable }}
+ {{ object.cable|linkify }}
@@ -89,15 +81,11 @@
{% if object.connected_endpoint %}
|
Device |
-
- {{ object.connected_endpoint.device }}
- |
+ {{ object.connected_endpoint.device|linkify }} |
Name |
-
- {{ object.connected_endpoint.name }}
- |
+ {{ object.connected_endpoint|linkify:"name" }} |
Type |
diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html
index aa8d3a94f..6574e9b74 100644
--- a/netbox/templates/dcim/rack.html
+++ b/netbox/templates/dcim/rack.html
@@ -39,9 +39,9 @@
Site |
{% if object.site.region %}
- {{ object.site.region }} /
+ {{ object.site.region|linkify }} /
{% endif %}
- {{ object.site }}
+ {{ object.site|linkify }}
|
@@ -49,9 +49,9 @@
{% if object.location %}
{% for location in object.location.get_ancestors %}
- {{ location }} /
+ {{ location|linkify }} /
{% endfor %}
- {{ object.location }}
+ {{ object.location|linkify }}
{% else %}
None
{% endif %}
@@ -64,14 +64,10 @@
|
Tenant |
- {% if object.tenant %}
- {% if object.tenant.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
@@ -80,13 +76,7 @@
Role |
-
- {% if object.role %}
- {{ object.role }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.role|linkify|placeholder }} |
Serial Number |
@@ -179,18 +169,10 @@
{% for powerfeed in power_feeds %}
-
- {{ powerfeed.power_panel.name }}
-
- |
- {{ powerfeed.name }}
- |
-
- {% badge powerfeed.get_status_display bg_color=powerfeed.get_status_color %}
- |
-
- {% badge powerfeed.get_type_display bg_color=powerfeed.get_type_color %}
- |
+ {{ powerfeed.power_panel|linkify }} |
+ {{ powerfeed|linkify }} |
+ {% badge powerfeed.get_status_display bg_color=powerfeed.get_status_color %} |
+ {% badge powerfeed.get_type_display bg_color=powerfeed.get_type_color %} |
{% with power_port=powerfeed.connected_endpoint %}
{% if power_port %}
{% utilization_graph power_port.get_power_draw.allocated|percentage:powerfeed.available_power %} |
@@ -220,16 +202,8 @@
{% for resv in reservations %}
-
- {{ resv.unit_list }}
- |
-
- {% if resv.tenant %}
- {{ resv.tenant }}
- {% else %}
- None
- {% endif %}
- |
+ {{ resv|linkify:"unit_list" }} |
+ {{ resv.tenant|linkify|placeholder }} |
{{ resv.description }}
{{ resv.user }} · {{ resv.created|annotated_date }}
diff --git a/netbox/templates/dcim/rackreservation.html b/netbox/templates/dcim/rackreservation.html
index 1e16af675..ebdd1d845 100644
--- a/netbox/templates/dcim/rackreservation.html
+++ b/netbox/templates/dcim/rackreservation.html
@@ -24,26 +24,18 @@
| Site |
{% if rack.site.region %}
- {{ rack.site.region }} /
+ {{ rack.site.region|linkify }} /
{% endif %}
- {{ rack.site }}
+ {{ rack.site|linkify }}
|
Location |
-
- {% if rack.location %}
- {{ rack.location }}
- {% else %}
- None
- {% endif %}
- |
+ {{ rack.location|linkify|placeholder }} |
Rack |
-
- {{ rack }}
- |
+ {{ rack|linkify }} |
{% endwith %}
@@ -62,14 +54,10 @@
Tenant |
- {% if object.tenant %}
- {% if object.tenant.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
diff --git a/netbox/templates/dcim/rearport.html b/netbox/templates/dcim/rearport.html
index 3be2510d5..3cdccbd7c 100644
--- a/netbox/templates/dcim/rearport.html
+++ b/netbox/templates/dcim/rearport.html
@@ -20,19 +20,11 @@
Device |
-
- {{ object.device }}
- |
+ {{ object.device|linkify }} |
Module |
-
- {% if object.module %}
- {{ object.module }}
- {% else %}
- {{ None|placeholder }}
- {% endif %}
- |
+ {{ object.module|linkify|placeholder }} |
Name |
@@ -82,7 +74,7 @@
Cable |
- {{ object.cable }}
+ {{ object.cable|linkify }}
diff --git a/netbox/templates/dcim/region.html b/netbox/templates/dcim/region.html
index 10ecb9ea6..8a548dd4a 100644
--- a/netbox/templates/dcim/region.html
+++ b/netbox/templates/dcim/region.html
@@ -37,13 +37,7 @@
|
Parent |
-
- {% if object.parent %}
- {{ object.parent }}
- {% else %}
- —
- {% endif %}
- |
+ {{ object.parent|linkify|placeholder }} |
Sites |
diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html
index 41255b4a0..fe0a558eb 100644
--- a/netbox/templates/dcim/site.html
+++ b/netbox/templates/dcim/site.html
@@ -30,9 +30,9 @@
{% if object.region %}
{% for region in object.region.get_ancestors %}
- {{ region }} /
+ {{ region|linkify }} /
{% endfor %}
- {{ object.region }}
+ {{ object.region|linkify }}
{% else %}
None
{% endif %}
@@ -43,9 +43,9 @@
|
{% if object.group %}
{% for group in object.group.get_ancestors %}
- {{ group }} /
+ {{ group|linkify }} /
{% endfor %}
- {{ object.group }}
+ {{ object.group|linkify }}
{% else %}
None
{% endif %}
@@ -58,14 +58,10 @@
|
Tenant |
- {% if object.tenant %}
- {% if object.tenant.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
@@ -242,7 +238,7 @@
{% for i in location.level|as_range %}{% endfor %}
- {{ location }}
+ {{ location|linkify }}
|
{{ location.rack_count }}
@@ -281,7 +277,7 @@
|
{% for asn in asns %}
- {{ asn }} |
+ {{ asn|linkify }} |
{{ asn.description|placeholder }} |
{% endfor %}
diff --git a/netbox/templates/dcim/sitegroup.html b/netbox/templates/dcim/sitegroup.html
index 49f91b812..396271147 100644
--- a/netbox/templates/dcim/sitegroup.html
+++ b/netbox/templates/dcim/sitegroup.html
@@ -37,13 +37,7 @@
Parent |
-
- {% if object.parent %}
- {{ object.parent }}
- {% else %}
- —
- {% endif %}
- |
+ {{ object.parent|linkify|placeholder }} |
Sites |
diff --git a/netbox/templates/dcim/trace/circuit.html b/netbox/templates/dcim/trace/circuit.html
index 70e191dd2..330099235 100644
--- a/netbox/templates/dcim/trace/circuit.html
+++ b/netbox/templates/dcim/trace/circuit.html
@@ -1,5 +1,5 @@
diff --git a/netbox/templates/dcim/trace/device.html b/netbox/templates/dcim/trace/device.html
index b1d37b76c..30d1d7149 100644
--- a/netbox/templates/dcim/trace/device.html
+++ b/netbox/templates/dcim/trace/device.html
@@ -1,11 +1,11 @@
diff --git a/netbox/templates/dcim/trace/object.html b/netbox/templates/dcim/trace/object.html
index 72e5b5787..fe9fe002b 100644
--- a/netbox/templates/dcim/trace/object.html
+++ b/netbox/templates/dcim/trace/object.html
@@ -1,3 +1,3 @@
diff --git a/netbox/templates/dcim/trace/powerpanel.html b/netbox/templates/dcim/trace/powerpanel.html
index f5b6230a7..d89b408fb 100644
--- a/netbox/templates/dcim/trace/powerpanel.html
+++ b/netbox/templates/dcim/trace/powerpanel.html
@@ -1,5 +1,5 @@
diff --git a/netbox/templates/dcim/trace/termination.html b/netbox/templates/dcim/trace/termination.html
index f2dbca87f..3a2dbded2 100644
--- a/netbox/templates/dcim/trace/termination.html
+++ b/netbox/templates/dcim/trace/termination.html
@@ -1,6 +1,6 @@
{% load helpers %}
-
{{ termination }}
+
{{ termination|linkify }}
{{ termination|meta:"verbose_name"|bettertitle }}
{% if termination.type %}
{{ termination.get_type_display }}
diff --git a/netbox/templates/dcim/virtualchassis.html b/netbox/templates/dcim/virtualchassis.html
index 2e1344f71..4683b775b 100644
--- a/netbox/templates/dcim/virtualchassis.html
+++ b/netbox/templates/dcim/virtualchassis.html
@@ -27,13 +27,7 @@
Master |
-
- {% if object.master %}
- {{ object.master }}
- {% else %}
- —
- {% endif %}
- |
+ {{ object.master|linkify }} |
@@ -58,7 +52,7 @@
{% for vc_member in members %}
- {{ vc_member }}
+ {{ vc_member|linkify }}
|
{% badge vc_member.vc_position show_empty=True %}
diff --git a/netbox/templates/dcim/virtualchassis_edit.html b/netbox/templates/dcim/virtualchassis_edit.html
index a37ff102a..327f20531 100644
--- a/netbox/templates/dcim/virtualchassis_edit.html
+++ b/netbox/templates/dcim/virtualchassis_edit.html
@@ -51,9 +51,7 @@
{% endfor %}
{% with device=form.instance virtual_chassis=vc_form.instance %}
|
-
- {{ device }}
- |
+ {{ device|linkify }} |
{{ device.pk }} |
{% if device.rack %}
diff --git a/netbox/templates/extras/configcontext.html b/netbox/templates/extras/configcontext.html
index 3a9cc2e0c..56ec52c07 100644
--- a/netbox/templates/extras/configcontext.html
+++ b/netbox/templates/extras/configcontext.html
@@ -56,7 +56,7 @@
|
{% for object in objects %}
- - {{ object }}
+ - {{ object|linkify }}
{% empty %}
- None
{% endfor %}
diff --git a/netbox/templates/extras/imageattachment_edit.html b/netbox/templates/extras/imageattachment_edit.html
index c841b9797..75b2ce48b 100644
--- a/netbox/templates/extras/imageattachment_edit.html
+++ b/netbox/templates/extras/imageattachment_edit.html
@@ -10,7 +10,7 @@
diff --git a/netbox/templates/extras/journalentry.html b/netbox/templates/extras/journalentry.html
index 4a38fb4e3..6d1d9599c 100644
--- a/netbox/templates/extras/journalentry.html
+++ b/netbox/templates/extras/journalentry.html
@@ -18,21 +18,15 @@
Object |
-
- {{ object.assigned_object }}
- |
+ {{ object.assigned_object|linkify }} |
Created |
-
- {{ object.created|annotated_date }}
- |
+ {{ object.created|annotated_date }} |
Created By |
-
- {{ object.created_by }}
- |
+ {{ object.created_by }} |
Kind |
diff --git a/netbox/templates/extras/object_configcontext.html b/netbox/templates/extras/object_configcontext.html
index 7edeeed27..ab730410e 100644
--- a/netbox/templates/extras/object_configcontext.html
+++ b/netbox/templates/extras/object_configcontext.html
@@ -43,7 +43,7 @@
{{ context.weight }}
- {{ context.name }}
+ {{ context|linkify:"name" }}">
{% if context.description %}
{{ context.description }}
{% endif %}
diff --git a/netbox/templates/extras/objectchange.html b/netbox/templates/extras/objectchange.html
index 70fe19304..c66f675bc 100644
--- a/netbox/templates/extras/objectchange.html
+++ b/netbox/templates/extras/objectchange.html
@@ -61,7 +61,7 @@
Object |
{% if object.changed_object and object.changed_object.get_absolute_url %}
- {{ object.changed_object }}
+ {{ object.changed_object|linkify }}
{% else %}
{{ object.object_repr }}
{% endif %}
diff --git a/netbox/templates/inc/panels/contacts.html b/netbox/templates/inc/panels/contacts.html
index e3e5cf483..26961f04a 100644
--- a/netbox/templates/inc/panels/contacts.html
+++ b/netbox/templates/inc/panels/contacts.html
@@ -14,9 +14,7 @@
|
{% for contact in contacts %}
-
- {{ contact.contact }}
- |
+ {{ contact.contact|linkify }} |
{{ contact.role|placeholder }} |
{{ contact.get_priority_display|placeholder }} |
diff --git a/netbox/templates/inc/panels/custom_fields.html b/netbox/templates/inc/panels/custom_fields.html
index 88a4660f2..e0c7076ca 100644
--- a/netbox/templates/inc/panels/custom_fields.html
+++ b/netbox/templates/inc/panels/custom_fields.html
@@ -27,11 +27,11 @@
{% elif field.type == 'multiselect' and value %}
{{ value|join:", " }}
{% elif field.type == 'object' and value %}
- {{ value }}
+ {{ value|linkify }}
{% elif field.type == 'multiobject' and value %}
{% for obj in value %}
- - {{ obj }}
+ - {{ obj|linkify }}
{% endfor %}
{% elif value %}
diff --git a/netbox/templates/ipam/aggregate.html b/netbox/templates/ipam/aggregate.html
index 9f657c911..f3eff9df1 100644
--- a/netbox/templates/ipam/aggregate.html
+++ b/netbox/templates/ipam/aggregate.html
@@ -29,14 +29,10 @@
|
Tenant |
- {% if object.tenant %}
- {% if prefix.object.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
diff --git a/netbox/templates/ipam/asn.html b/netbox/templates/ipam/asn.html
index 4a1ecda0d..6c092f598 100644
--- a/netbox/templates/ipam/asn.html
+++ b/netbox/templates/ipam/asn.html
@@ -29,14 +29,10 @@
Tenant |
- {% if object.tenant %}
- {% if prefix.object.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
diff --git a/netbox/templates/ipam/inc/panels/fhrp_groups.html b/netbox/templates/ipam/inc/panels/fhrp_groups.html
index 6583694ef..f83e6a4f3 100644
--- a/netbox/templates/ipam/inc/panels/fhrp_groups.html
+++ b/netbox/templates/ipam/inc/panels/fhrp_groups.html
@@ -16,21 +16,14 @@
{% for assignment in object.fhrp_group_assignments.all %}
-
- {{ assignment.group.group_id }}
- |
-
- {{ assignment.group.get_protocol_display }}
- |
+ {{ assignment.group|linkify:"group_id" }} |
+ {{ assignment.group.get_protocol_display }} |
{% for ipaddress in assignment.group.ip_addresses.all %}
- {{ ipaddress }}
- {% if not forloop.last %} {% endif %}
+ {{ ipaddress|linkify }}{% if not forloop.last %} {% endif %}
{% endfor %}
|
-
- {{ assignment.priority }}
- |
+ {{ assignment.priority }} |
{% if perms.ipam.change_fhrpgroupassignment %}
diff --git a/netbox/templates/ipam/inc/service.html b/netbox/templates/ipam/inc/service.html
index 2670b6fa5..0d6faf1dc 100644
--- a/netbox/templates/ipam/inc/service.html
+++ b/netbox/templates/ipam/inc/service.html
@@ -1,5 +1,5 @@
- {{ service.name }} |
+ {{ service|linkify:"name" }} |
{{ service.get_protocol_display }} |
{{ service.port_list }} |
diff --git a/netbox/templates/ipam/ipaddress.html b/netbox/templates/ipam/ipaddress.html
index 779d211f5..7867e829b 100644
--- a/netbox/templates/ipam/ipaddress.html
+++ b/netbox/templates/ipam/ipaddress.html
@@ -36,14 +36,10 @@
|
Tenant |
- {% if object.tenant %}
- {% if object.tenant.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
@@ -73,9 +69,9 @@
{% if object.assigned_object %}
{% if object.assigned_object.parent_object %}
- {{ object.assigned_object.parent_object }} /
+ {{ object.assigned_object.parent_object|linkify }} /
{% endif %}
- {{ object.assigned_object }}
+ {{ object.assigned_object|linkify }}
{% else %}
—
{% endif %}
@@ -85,9 +81,9 @@
| NAT (inside) |
{% if object.nat_inside %}
- {{ object.nat_inside }}
+ {{ object.nat_inside|linkify }}
{% if object.nat_inside.assigned_object %}
- ({{ object.nat_inside.assigned_object.parent_object }})
+ ({{ object.nat_inside.assigned_object.parent_object|linkify }})
{% endif %}
{% else %}
None
@@ -96,13 +92,7 @@
|
NAT (outside) |
-
- {% if object.nat_outside %}
- {{ object.nat_outside }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.nat_outside|linkify|placeholder }} |
|
diff --git a/netbox/templates/ipam/iprange.html b/netbox/templates/ipam/iprange.html
index e4f27d68c..c78b5a132 100644
--- a/netbox/templates/ipam/iprange.html
+++ b/netbox/templates/ipam/iprange.html
@@ -37,7 +37,7 @@
VRF |
{% if object.vrf %}
- {{ object.vrf }} ({{ object.vrf.rd }})
+ {{ object.vrf|linkify }} ({{ object.vrf.rd }})
{% else %}
Global
{% endif %}
@@ -45,13 +45,7 @@
| |
Role |
-
- {% if object.role %}
- {{ object.role }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.role|linkify|placeholder }} |
Status |
@@ -60,14 +54,10 @@
Tenant |
- {% if object.tenant %}
- {% if object.tenant.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
diff --git a/netbox/templates/ipam/prefix.html b/netbox/templates/ipam/prefix.html
index ba3e84911..e2ba76a82 100644
--- a/netbox/templates/ipam/prefix.html
+++ b/netbox/templates/ipam/prefix.html
@@ -26,16 +26,12 @@
Tenant |
-
- {% if object.tenant %}
+ |
{% if object.tenant.group %}
- {{ object.tenant.group }} /
+ {{ object.tenant.group|linkify }} /
{% endif %}
- {{ object.tenant }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.tenant|linkify|placeholder }}
+
Aggregate |
@@ -52,9 +48,9 @@
{% if object.site %}
{% if object.site.region %}
- {{ object.site.region }} /
+ {{ object.site.region|linkify }} /
{% endif %}
- {{ object.site }}
+ {{ object.site|linkify }}
{% else %}
None
{% endif %}
@@ -65,9 +61,9 @@
|
{% if object.vlan %}
{% if object.vlan.group %}
- {{ object.vlan.group }} /
+ {{ object.vlan.group|linkify }} /
{% endif %}
- {{ object.vlan }}
+ {{ object.vlan|linkify }}
{% else %}
None
{% endif %}
@@ -79,13 +75,7 @@
|
Role |
-
- {% if object.role %}
- {{ object.role }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.role|linkify|placeholder }} |
Description |
diff --git a/netbox/templates/ipam/routetarget.html b/netbox/templates/ipam/routetarget.html
index 71d6f9601..e093aee61 100644
--- a/netbox/templates/ipam/routetarget.html
+++ b/netbox/templates/ipam/routetarget.html
@@ -15,13 +15,7 @@
Tenant |
-
- {% if object.tenant %}
- {{ object.tenant }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.tenant|linkify|placeholder }} |
Description |
diff --git a/netbox/templates/ipam/service.html b/netbox/templates/ipam/service.html
index 5a47e44f0..71ea20fa5 100644
--- a/netbox/templates/ipam/service.html
+++ b/netbox/templates/ipam/service.html
@@ -28,9 +28,7 @@
Parent |
-
- {{ object.parent }}
- |
+ {{ object.parent|linkify }} |
Protocol |
@@ -44,7 +42,7 @@
IP Addresses |
{% for ipaddress in object.ipaddresses.all %}
- {{ ipaddress }}
+ {{ ipaddress|linkify }}
{% empty %}
None
{% endfor %}
diff --git a/netbox/templates/ipam/vlan.html b/netbox/templates/ipam/vlan.html
index dc19bd34e..f74149ad6 100644
--- a/netbox/templates/ipam/vlan.html
+++ b/netbox/templates/ipam/vlan.html
@@ -17,9 +17,9 @@
|
{% if object.site %}
{% if object.site.region %}
- {{ object.site.region }} /
+ {{ object.site.region|linkify }} /
{% endif %}
- {{ object.site }}
+ {{ object.site|linkify }}
{% else %}
None
{% endif %}
@@ -27,13 +27,7 @@
|
Group |
-
- {% if object.group %}
- {{ object.group }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.group|linkify|placeholder }} |
VLAN ID |
@@ -46,14 +40,10 @@
Tenant |
- {% if object.tenant %}
- {% if object.tenant.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
diff --git a/netbox/templates/ipam/vlangroup.html b/netbox/templates/ipam/vlangroup.html
index f92afce46..822b4a046 100644
--- a/netbox/templates/ipam/vlangroup.html
+++ b/netbox/templates/ipam/vlangroup.html
@@ -7,7 +7,7 @@
{{ block.super }}
{% if object.scope %}
{# TODO: This should link to a filtered list of VLANGroups #}
- {{ object.scope }}
+ {{ object.scope|linkify }}
{% endif %}
{% endblock %}
@@ -36,12 +36,7 @@
Scope |
-
- {% if object.scope %}
- {{ object.scope }}
- {% else %}
- —
- {% endif %}
+ | {{ object.scope|linkify|placeholder }} |
Permitted VIDs |
diff --git a/netbox/templates/ipam/vrf.html b/netbox/templates/ipam/vrf.html
index ae4f65887..831338600 100644
--- a/netbox/templates/ipam/vrf.html
+++ b/netbox/templates/ipam/vrf.html
@@ -21,11 +21,10 @@
Tenant |
- {% if object.tenant %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
diff --git a/netbox/templates/tenancy/contact.html b/netbox/templates/tenancy/contact.html
index 6fa7c03d8..3b97a5a20 100644
--- a/netbox/templates/tenancy/contact.html
+++ b/netbox/templates/tenancy/contact.html
@@ -19,13 +19,7 @@
Group |
-
- {% if object.group %}
- {{ object.group }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.group|linkify|placeholder }} |
Name |
diff --git a/netbox/templates/tenancy/contactgroup.html b/netbox/templates/tenancy/contactgroup.html
index 7aed8182b..3f13dc932 100644
--- a/netbox/templates/tenancy/contactgroup.html
+++ b/netbox/templates/tenancy/contactgroup.html
@@ -29,13 +29,7 @@
Parent |
-
- {% if object.parent %}
- {{ object.parent }}
- {% else %}
- —
- {% endif %}
- |
+ {{ object.parent|linkify|placeholder }} |
Contacts |
diff --git a/netbox/templates/tenancy/tenant.html b/netbox/templates/tenancy/tenant.html
index fb83a346f..e4c1db006 100644
--- a/netbox/templates/tenancy/tenant.html
+++ b/netbox/templates/tenancy/tenant.html
@@ -20,13 +20,7 @@
Group |
-
- {% if object.group %}
- {{ object.group }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.group|linkify|placeholder }} |
Description |
diff --git a/netbox/templates/tenancy/tenantgroup.html b/netbox/templates/tenancy/tenantgroup.html
index 653c40a87..25f1fef1b 100644
--- a/netbox/templates/tenancy/tenantgroup.html
+++ b/netbox/templates/tenancy/tenantgroup.html
@@ -37,13 +37,7 @@
Parent |
-
- {% if object.parent %}
- {{ object.parent }}
- {% else %}
- —
- {% endif %}
- |
+ {{ object.parent|linkify|placeholder }} |
Tenants |
diff --git a/netbox/templates/virtualization/cluster.html b/netbox/templates/virtualization/cluster.html
index b7af89bb2..8acbb61f4 100644
--- a/netbox/templates/virtualization/cluster.html
+++ b/netbox/templates/virtualization/cluster.html
@@ -17,37 +17,24 @@
Type |
- {{ object.type }} |
+ {{ object.type|linkify }} |
Group |
-
- {% if object.group %}
- {{ object.group }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.group|linkify }} |
Tenant |
- {% if object.tenant %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
Site |
-
- {% if object.site %}
- {{ object.site }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.site|linkify }} |
Virtual Machines |
diff --git a/netbox/templates/virtualization/virtualmachine.html b/netbox/templates/virtualization/virtualmachine.html
index 22dd27b97..0dec4968c 100644
--- a/netbox/templates/virtualization/virtualmachine.html
+++ b/netbox/templates/virtualization/virtualmachine.html
@@ -23,35 +23,19 @@
Role |
-
- {% if object.role %}
- {{ object.role }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.role|linkify|placeholder }} |
Platform |
-
- {% if object.platform %}
- {{ object.platform }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.platform|linkify|placeholder }} |
Tenant |
- {% if object.tenant %}
- {% if object.tenant.group %}
- {{ object.tenant.group }} /
- {% endif %}
- {{ object.tenant }}
- {% else %}
- None
+ {% if object.tenant.group %}
+ {{ object.tenant.group|linkify }} /
{% endif %}
+ {{ object.tenant|linkify|placeholder }}
|
@@ -103,9 +87,9 @@
Cluster |
{% if object.cluster.group %}
- {{ object.cluster.group }} /
+ {{ object.cluster.group|linkify }} /
{% endif %}
- {{ object.cluster }}
+ {{ object.cluster|linkify }}
|
diff --git a/netbox/templates/virtualization/vminterface.html b/netbox/templates/virtualization/vminterface.html
index 6d10ce91e..635654f86 100644
--- a/netbox/templates/virtualization/vminterface.html
+++ b/netbox/templates/virtualization/vminterface.html
@@ -21,9 +21,7 @@
Virtual Machine |
-
- {{ object.virtual_machine }}
- |
+ {{ object.virtual_machine|linkify }} |
Name |
@@ -41,33 +39,15 @@
Parent |
-
- {% if object.parent %}
- {{ object.parent }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.parent|linkify|placeholder }} |
Bridge |
-
- {% if object.bridge %}
- {{ object.bridge }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.bridge|linkify|placeholder }} |
VRF |
-
- {% if object.vrf %}
- {{ object.vrf }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.vrf|linkify|placeholder }} |
Description |
diff --git a/netbox/templates/wireless/inc/wirelesslink_interface.html b/netbox/templates/wireless/inc/wirelesslink_interface.html
index e33047539..db4f84f0a 100644
--- a/netbox/templates/wireless/inc/wirelesslink_interface.html
+++ b/netbox/templates/wireless/inc/wirelesslink_interface.html
@@ -3,15 +3,11 @@
Device |
-
- {{ interface.device }}
- |
+ {{ interface.device|linkify }} |
Interface |
-
- {{ interface }}
- |
+ {{ interface|linkify }} |
Type |
diff --git a/netbox/templates/wireless/wirelesslan.html b/netbox/templates/wireless/wirelesslan.html
index a55d22974..185a44904 100644
--- a/netbox/templates/wireless/wirelesslan.html
+++ b/netbox/templates/wireless/wirelesslan.html
@@ -16,13 +16,7 @@
Group |
-
- {% if object.group %}
- {{ object.group }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.group|linkify|placeholder }} |
Description |
@@ -30,13 +24,7 @@
VLAN |
-
- {% if object.vlan %}
- {{ object.vlan }}
- {% else %}
- None
- {% endif %}
- |
+ {{ object.vlan|linkify|placeholder }} |
diff --git a/netbox/templates/wireless/wirelesslangroup.html b/netbox/templates/wireless/wirelesslangroup.html
index 226b39b1b..2b8de0fb8 100644
--- a/netbox/templates/wireless/wirelesslangroup.html
+++ b/netbox/templates/wireless/wirelesslangroup.html
@@ -35,13 +35,7 @@
Parent |
-
- {% if object.parent %}
- {{ object.parent }}
- {% else %}
- —
- {% endif %}
- |
+ {{ object.parent|linkify|placeholder }} |
Wireless LANs |
diff --git a/netbox/utilities/templatetags/builtins/filters.py b/netbox/utilities/templatetags/builtins/filters.py
index afb40a308..4a3db0a3c 100644
--- a/netbox/utilities/templatetags/builtins/filters.py
+++ b/netbox/utilities/templatetags/builtins/filters.py
@@ -20,6 +20,26 @@ register = template.Library()
# General
#
+@register.filter()
+def linkify(instance, attr=None):
+ """
+ Render a hyperlink for an object with a `get_absolute_url()` method, optionally specifying the name of an
+ attribute to use for the link text. If no attribute is given, the object's string representation will be
+ used.
+
+ If the object has no `get_absolute_url()` method, return the text without a hyperlink element.
+ """
+ if instance is None:
+ return ''
+
+ text = getattr(instance, attr) if attr is not None else str(instance)
+ try:
+ url = instance.get_absolute_url()
+ return mark_safe(f'{text}')
+ except (AttributeError, TypeError):
+ return text
+
+
@register.filter()
def bettertitle(value):
"""