From 83536fbb2391fbec404ff8f4e692be8556947360 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 29 Aug 2023 14:43:07 -0400 Subject: [PATCH] #12814: Add context data section to config rendering doc --- docs/features/configuration-rendering.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/features/configuration-rendering.md b/docs/features/configuration-rendering.md index 9d212a34e..a87a6eae4 100644 --- a/docs/features/configuration-rendering.md +++ b/docs/features/configuration-rendering.md @@ -37,6 +37,14 @@ Configuration templates are written in the [Jinja2 templating language](https:// When rendered for a specific NetBox device, the template's `device` variable will be populated with the device instance, and `ntp_servers` will be pulled from the device's available context data. The resulting output will be a valid configuration segment that can be applied directly to a compatible network device. +### Context Data + +The objet for which the configuration is being rendered is made available as template context as `device` or `virtualmachine` for devices and virtual machines, respectively. Additionally, NetBox model classes can be accessed by the app or plugin in which they reside. For example: + +``` +There are {{ dcim.Site.objects.count() }} sites. +``` + ## Rendering Templates ### Device Configurations