Commit Graph

6 Commits

Author SHA1 Message Date
Renato Almeida de Oliveira
fbd6d8c7fc
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>
2025-04-08 10:37:15 -04:00
Rob Duffy
327ad8cfc9
Fixes #17490: Config Template unable to dynamically include templates (#18106)
* Fixes #17490: Config Template unable to dynamically include templates

* Cast the generator returned by find_referenced_templates() to an iterable to avoid exhausting it on the check for None

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Apply the path__in filter to avoid duplicating code

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Remove extra if None not in referenced_templates

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-12-04 21:11:12 -05:00
Jeremy Stretch
1d3efc90c0 Move utilities.utils.render_jinja2() to utilities.jinja2 2024-03-22 08:59:52 -04:00
Jeremy Stretch
c30d22335a Move extras.jinja2.ConfigTemplateLoader to utilities.jinja2.DataFileLoader 2024-03-22 08:59:52 -04:00
Jeremy Stretch
f49819ebc2 Move ConfigTemplateLoader from utilities.jinja2 to extras.jinja2 2024-03-22 08:59:52 -04:00
Jeremy Stretch
73a7a2d27a Closes #11559: Implement config template rendering (#11769)
* WIP

* Add config_template field to Device

* Pre-fetch referenced templates

* Correct up_to_date callable

* Add config_template FK to Device

* Update & merge migrations

* Add config_template FK to Platform

* Add tagging support for ConfigTemplate

* Catch exceptions when rendering device templates in UI

* Refactor ConfigTemplate.render()

* Add support for returning plain text content

* Add ConfigTemplate model documentation

* Add feature documentation for config rendering
2023-02-19 20:09:52 -05:00