Update export-templates.md

This commit is contained in:
tcaiazza 2021-04-05 11:06:55 -04:00 committed by GitHub
parent 3d286fbdc3
commit 9463622d3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,14 @@ Height: {{ rack.u_height }}U
To access custom fields of an object within a template, use the `cf` attribute. For example, `{{ obj.cf.color }}` will return the value (if any) for a custom field named `color` on `obj`. To access custom fields of an object within a template, use the `cf` attribute. For example, `{{ obj.cf.color }}` will return the value (if any) for a custom field named `color` on `obj`.
Since local_context_data is part of an object, it is immediately available to use in the export template, however if you need the fully rendered context config you'll need to use the function `get_config_context`. For example:
```
{% for server in queryset %}
{% set data = server.get_config_context() %}
{{data.syslog}}
{% endfor %}
```
A MIME type and file extension can optionally be defined for each export template. The default MIME type is `text/plain`. A MIME type and file extension can optionally be defined for each export template. The default MIME type is `text/plain`.
## Example ## Example