Skip to content
Snippets Groups Projects
Commit 5eb8af36 authored by Alice Heaton's avatar Alice Heaton :speech_balloon:
Browse files

Ensure render_widget works if a widget has no 'get_context_data', and fix dashboard tests

parent cd6763ab
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,8 @@ def render_widget(widget_instance):
# Get context
try:
context = widget.get_context_data(**settings)
except AttributeError:
context = {}
except Exception as e:
logger.exception('Error while fetching widget context data: %s', e)
template_name = 'dashboard/widget-error.html'
......
......@@ -150,5 +150,5 @@ class WidgetPoolTestCase(TestCase):
mock, 'template_name'
)
self.assertEqual(
template_name, 'dashboard/widget-missing-template.html'
template_name, 'dashboard/widget-error.html'
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment