Allow custom jinja filters in export templates #4820

Closed
opened 2025-12-29 19:20:56 +01:00 by adam · 4 comments
Owner

Originally created by @fabi125 on GitHub (Apr 23, 2021).

NetBox version

v2.10.6

Feature type

New functionality

Proposed functionality

We would like to add custom filters to our export templates. Ideally one should be able to add them via a plugin and then be able to load them in the export template.

Use case

We want regex_replace to be available in our export template.

I tried adding filters in a templatetags folder to a netbox plugin and loading it in the template (which works for regular templates used within a plugin), but that fails with There was an error rendering the selected export template (filter_test): Encountered unknown tag 'load'.

Database changes

None

External dependencies

None

Originally created by @fabi125 on GitHub (Apr 23, 2021). ### NetBox version v2.10.6 ### Feature type New functionality ### Proposed functionality We would like to add custom filters to our export templates. Ideally one should be able to add them via a plugin and then be able to load them in the export template. ### Use case We want regex_replace to be available in our export template. I tried adding filters in a `templatetags` folder to a netbox plugin and `load`ing it in the template (which works for regular templates used within a plugin), but that fails with `There was an error rendering the selected export template (filter_test): Encountered unknown tag 'load'.` ### Database changes None ### External dependencies None
adam added the type: featurepending closurestatus: revisions needed labels 2025-12-29 19:20:56 +01:00
adam closed this issue 2025-12-29 19:20:57 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 23, 2021):

Please elaborate on the specific change(s) you're proposing to support this functionality.

@jeremystretch commented on GitHub (Apr 23, 2021): Please elaborate on the specific change(s) you're proposing to support this functionality.
Author
Owner

@fabi125 commented on GitHub (Apr 23, 2021):

Is there a way that export templates behave like regular django templates? I feel like that would fix this issue.

Otherwise I'd have to spend some more time reading the code to make a more substantial suggestion on how this potentially could be achieved.

@fabi125 commented on GitHub (Apr 23, 2021): Is there a way that export templates behave like regular django templates? I feel like that would fix this issue. Otherwise I'd have to spend some more time reading the code to make a more substantial suggestion on how this potentially could be achieved.
Author
Owner

@github-actions[bot] commented on GitHub (Jun 23, 2021):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jun 23, 2021): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Jul 24, 2021):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Jul 24, 2021): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4820