1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #3085: Catch all exceptions during export template rendering

This commit is contained in:
Jeremy Stretch
2019-05-02 15:36:30 -04:00
parent eb41bc66a4
commit 244c07e5f7
2 changed files with 8 additions and 2 deletions

View File

@@ -126,10 +126,12 @@ class ObjectListView(View):
queryset = CustomFieldQueryset(self.queryset, custom_fields) if custom_fields else self.queryset
try:
return et.render_to_response(queryset)
except TemplateSyntaxError:
except Exception as e:
messages.error(
request,
"There was an error rendering the selected export template ({}).".format(et.name)
"There was an error rendering the selected export template ({}): {}".format(
et.name, e
)
)
# Fall back to built-in CSV formatting if export requested but no template specified