From 3bdbf67b8f18eaf52ca45ed9d97db1dbed56b6d1 Mon Sep 17 00:00:00 2001 From: Jop Zinkweg Date: Tue, 2 May 2023 10:21:09 +0200 Subject: [PATCH] Update examples to reflect obj rename to object #8684 missed some references to ```obj``` --- docs/customization/custom-links.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/customization/custom-links.md b/docs/customization/custom-links.md index 5d1cd4556..baae1db4f 100644 --- a/docs/customization/custom-links.md +++ b/docs/customization/custom-links.md @@ -2,12 +2,12 @@ Custom links allow users to display arbitrary hyperlinks to external content within NetBox object views. These are helpful for cross-referencing related records in systems outside NetBox. For example, you might create a custom link on the device view which links to the current device in a Network Monitoring System (NMS). -Custom links are created by navigating to Customization > Custom Links. Each link is associated with a particular NetBox object type (site, device, prefix, etc.) and will be displayed on relevant views. Each link has display text and a URL, and data from the NetBox item being viewed can be included in the link using [Jinja2 template code](https://jinja2docs.readthedocs.io/en/stable/) through the variable `obj`, and custom fields through `obj.cf`. +Custom links are created by navigating to Customization > Custom Links. Each link is associated with a particular NetBox object type (site, device, prefix, etc.) and will be displayed on relevant views. Each link has display text and a URL, and data from the NetBox item being viewed can be included in the link using [Jinja2 template code](https://jinja2docs.readthedocs.io/en/stable/) through the variable `object`, and custom fields through `object.cf`. For example, you might define a link like this: * Text: `View NMS` -* URL: `https://nms.example.com/nodes/?name={{ obj.name }}` +* URL: `https://nms.example.com/nodes/?name={{ object.name }}` When viewing a device named Router4, this link would render as: @@ -43,7 +43,7 @@ Only links which render with non-empty text are included on the page. You can em For example, if you only want to display a link for active devices, you could set the link text to ```jinja2 -{% if obj.status == 'active' %}View NMS{% endif %} +{% if object.status == 'active' %}View NMS{% endif %} ``` The link will not appear when viewing a device with any status other than "active." @@ -51,7 +51,7 @@ The link will not appear when viewing a device with any status other than "activ As another example, if you wanted to show only devices belonging to a certain manufacturer, you could do something like this: ```jinja2 -{% if obj.device_type.manufacturer.name == 'Cisco' %}View NMS{% endif %} +{% if object.device_type.manufacturer.name == 'Cisco' %}View NMS{% endif %} ``` The link will only appear when viewing a device with a manufacturer name of "Cisco."