Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #17653 Add function to trim whitespaces in export templates via jinja environment settings #19078

Conversation

renatoalmeidaoliveira
Copy link
Collaborator

Fixes: #17653 Add function to trim whitespaces in export templates via jinja environment settings

  • Creates RenderMixin model with fields: template_code, environment_params, mime_type, file_name, file_extension, as_attachment
  • Add RenderMixin to ExportTemplate and ConfigTemplate, removing the repeated fields
  • Unify the export logic inside RenderMixin using ExportTemplate as reference for exports, i.e. always using template_code instead of using data_file when exists, because template_code should be equals to data_file after sync and it gives the end user more control of what template is in use.

Extra Comments:

  • Allowing the user to setup file_name and file_extension to ConfigTemplate may give the user more flexibility in ZTP use cases using NetBox as source of python ZTP configuration files,

@renatoalmeidaoliveira renatoalmeidaoliveira requested review from a team and jeremystretch and removed request for a team April 4, 2025 02:17
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you're completing the checklist for extending models each time you add a new field. The REST API serializers, GraphQL types, and several forms also need to be updated to reflect the new fields.

@jeremystretch jeremystretch merged commit fbd6d8c into netbox-community:feature Apr 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants