netbox/docs/models/extras/exporttemplate.md
Jason Novinger 80440fd025
Fixes #17443: Adds ExportTemplate.file_name field (#18911)
* Fixes #17443: Adds ExportTemplate.file_name field

* Addresses PR feedback

- Adds `file_name` to `ExportTemplateBulkEditForm.nullable_fields`
- Shortens max length of `ExportTemplate.file_name` to 200 chars
- Adds tests for `ExportTemplateFilterSet.file_extension`

* Fixes migration conflict caused by fix for #17841
2025-03-20 09:17:56 -04:00

1.4 KiB

Export Templates

Export templates are used to render arbitrary data from a set of NetBox objects. For example, you might want to automatically generate a network monitoring service configuration from a list of device objects. See the export templates documentation for more information.

Fields

Name

The name of the export template. This will appear in the "export" dropdown list in the NetBox UI.

Content Type

The type of NetBox object to which the export template applies.

Data File

Template code may optionally be sourced from a remote data file, which is synchronized from a remote data source. When designating a data file, there is no need to specify local content for the template: It will be populated automatically from the data file.

Template Code

Jinja2 template code for rendering the exported data.

MIME Type

The MIME type to indicate in the response when rendering the export template (optional). Defaults to text/plain.

File Name

The file name to give to the rendered export file (optional).

!!! info "This field was introduced in NetBox v4.3."

File Extension

The file extension to append to the file name in the response (optional).

As Attachment

If selected, the rendered content will be returned as a file attachment, rather than displayed directly in-browser (where supported).