Enable rendering job data using a custom HTML template #11347

Closed
opened 2025-12-29 21:44:01 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Jul 3, 2025).

NetBox version

v4.3.3

Feature type

New functionality

Proposed functionality

Extend the JobRunner class to allow specifying the path to a custom template. If provided, this template will be used to render the job's data in the UI.

class MyJob(JobRunner):
    template_name = 'foo/my_job.html'
    
    def run(self, *args, **kwargs):
        ...

Also add a render() method to JobRunner, which will render HTML content from the template, using the job's data as context.

Use case

This will enable the presentation of job data to the user via more elegant means, as opposed to raw data. NetBox does something similar today for custom scripts, but this requires a separate view (ScriptResultView). (It is likely that this view can be replaced by this feature.)

Database changes

N/A

External dependencies

N/A

Originally created by @jeremystretch on GitHub (Jul 3, 2025). ### NetBox version v4.3.3 ### Feature type New functionality ### Proposed functionality Extend the JobRunner class to allow specifying the path to a custom template. If provided, this template will be used to render the job's data in the UI. ```python class MyJob(JobRunner): template_name = 'foo/my_job.html' def run(self, *args, **kwargs): ... ``` Also add a `render()` method to JobRunner, which will render HTML content from the template, using the job's data as context. ### Use case This will enable the presentation of job data to the user via more elegant means, as opposed to raw data. NetBox does something similar today for custom scripts, but this requires a separate view (`ScriptResultView`). (It is likely that this view can be replaced by this feature.) ### Database changes N/A ### External dependencies N/A
adam added the type: featurecomplexity: medium labels 2025-12-29 21:44:01 +01:00
adam closed this issue 2025-12-29 21:44:01 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 6, 2025):

It occurs to me after further consideration that merely supporting custom HTML template is probably insufficient for many use cases. ScriptResultView, for instance, requires additional logic within the view to filter and render the script log.

Going to close this out as there's no strong use case currently to justify moving forward with it.

@jeremystretch commented on GitHub (Aug 6, 2025): It occurs to me after further consideration that merely supporting custom HTML template is probably insufficient for many use cases. ScriptResultView, for instance, requires additional logic within the view to filter and render the script log. Going to close this out as there's no strong use case currently to justify moving forward with it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11347