Closes #17653: Add function to trim whitespaces in export templates via jinja environment settings (#19078)
* Create RenderMixin, and unify template_code rendering and exporting * Join migrations * Add DEFAULT_MIME_TE constant * Move RenderMixin to extras.models.mixins, Rename RenderMixin to RenderTemplateMixin * Add render_jinja2 to __all__ * Rename ConfigTemplateFilterForm rendering FieldSet * ConfigTemplate lint * Simplify ExportTemplate get_context * Fix table order, and add fields for translations * Update Serializers * Update forms, tables, graphQL, API * Add extra tests for ConfigTemplate and ExportTemplate * Documentation update * Fix typo * Misc cleanup * Clean up template layouts --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:

committed by
GitHub

parent
3902cab925
commit
fbd6d8c7fc
@@ -12,10 +12,6 @@ See the [configuration rendering documentation](../../features/configuration-ren
|
||||
|
||||
A unique human-friendly name.
|
||||
|
||||
### Weight
|
||||
|
||||
A numeric value which influences the order in which context data is merged. Contexts with a lower weight are merged before those with a higher weight.
|
||||
|
||||
### Data File
|
||||
|
||||
Template code may optionally be sourced from a remote [data file](../core/datafile.md), which is synchronized from a remote data source. When designating a data file, there is no need to specify template code: It will be populated automatically from the data file.
|
||||
@@ -27,3 +23,27 @@ Jinja2 template code, if being defined locally rather than replicated from a dat
|
||||
### Environment Parameters
|
||||
|
||||
A dictionary of any additional parameters to pass when instantiating the [Jinja2 environment](https://jinja.palletsprojects.com/en/3.1.x/api/#jinja2.Environment). Jinja2 supports various optional parameters which can be used to modify its default behavior.
|
||||
|
||||
### MIME Type
|
||||
|
||||
!!! info "This field was introduced in NetBox v4.3."
|
||||
|
||||
The MIME type to indicate in the response when rendering the configuration template (optional). Defaults to `text/plain`.
|
||||
|
||||
### File Name
|
||||
|
||||
!!! info "This field was introduced in NetBox v4.3."
|
||||
|
||||
The file name to give to the rendered export file (optional).
|
||||
|
||||
### File Extension
|
||||
|
||||
!!! info "This field was introduced in NetBox v4.3."
|
||||
|
||||
The file extension to append to the file name in the response (optional).
|
||||
|
||||
### As Attachment
|
||||
|
||||
!!! info "This field was introduced in NetBox v4.3."
|
||||
|
||||
If selected, the rendered content will be returned as a file attachment, rather than displayed directly in-browser (where supported).
|
@@ -20,6 +20,12 @@ Template code may optionally be sourced from a remote [data file](../core/datafi
|
||||
|
||||
Jinja2 template code for rendering the exported data.
|
||||
|
||||
### Environment Parameters
|
||||
|
||||
!!! info "This field was introduced in NetBox v4.3."
|
||||
|
||||
A dictionary of any additional parameters to pass when instantiating the [Jinja2 environment](https://jinja.palletsprojects.com/en/3.1.x/api/#jinja2.Environment). Jinja2 supports various optional parameters which can be used to modify its default behavior.
|
||||
|
||||
### MIME Type
|
||||
|
||||
The MIME type to indicate in the response when rendering the export template (optional). Defaults to `text/plain`.
|
||||
@@ -28,8 +34,6 @@ The MIME type to indicate in the response when rendering the export template (op
|
||||
|
||||
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).
|
||||
|
Reference in New Issue
Block a user