diff --git a/docs/additional-features/custom-links.md b/docs/additional-features/custom-links.md index 7be837529..0a00b6d68 100644 --- a/docs/additional-features/custom-links.md +++ b/docs/additional-features/custom-links.md @@ -17,6 +17,18 @@ When viewing a device named Router4, this link would render as: Custom links appear as buttons at the top right corner of the page. Numeric weighting can be used to influence the ordering of links. +## Context Data + +The following context data is available within the template when rendering a custom link's text or URL. + +| Variable | Description | +|----------|-------------| +| `obj` | The NetBox object being displayed | +| `debug` | A boolean indicating whether debugging is enabled | +| `request` | The current WSGI request | +| `user` | The current user (if authenticated) | +| `perms` | The [permissions](https://docs.djangoproject.com/en/stable/topics/auth/default/#permissions) assigned to the user | + ## Conditional Rendering Only links which render with non-empty text are included on the page. You can employ conditional Jinja2 logic to control the conditions under which a link gets rendered. diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 646997b07..2249da3d8 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -2,6 +2,10 @@ ## v2.9.5 (FUTURE) +### Enhancements + +* [#5202](https://github.com/netbox-community/netbox/issues/5202) - Extend the available context data when rendering custom links + ### Bug Fixes * [#4523](https://github.com/netbox-community/netbox/issues/4523) - Populate site vlan list when bulk editing interfaces under certain circumstances diff --git a/netbox/extras/templatetags/custom_links.py b/netbox/extras/templatetags/custom_links.py index 7dae81a1f..84c274f6f 100644 --- a/netbox/extras/templatetags/custom_links.py +++ b/netbox/extras/templatetags/custom_links.py @@ -20,8 +20,8 @@ GROUP_BUTTON = '