Skip to content

Fixes #19496: Page error on config render with empty output #19527

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netbox/extras/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def get_extra_context(self, request, instance):

# Render the config template
rendered_config = None
error_message = None
error_message = ''
if config_template := instance.get_config_template():
try:
rendered_config = config_template.render(context=context_data)
Expand Down
6 changes: 5 additions & 1 deletion netbox/templates/extras/object_render_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ <h2 class="card-header d-flex justify-content-between">
</h2>
<pre class="card-body" id="rendered_config">{{ rendered_config }}</pre>
</div>
{% else %}
{% elif error_message %}
<div class="alert alert-warning">
<h4 class="alert-title mb-1">{% trans "Error rendering template" %}</h4>
{% trans error_message %}
</div>
{% else %}
<div class="alert alert-warning">
<h4 class="alert-title mb-1">{% trans "Template output is empty" %}</h4>
</div>
{% endif %}
{% else %}
<div class="alert alert-info">
Expand Down