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

Allow the basic text widget to display html

parent ab0d0c48
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@
{{ title }}
</div>
<div class='panel-body'>
{{ text }}
{% if html %}
{{ text|safe }}
{% else %}
{{ text }}
{% endif %}
</div>
</div>
......@@ -36,15 +36,19 @@ class BasicTextWidget(object):
Settings:
title: The widget title
text: The widget text
html: If true, the content contains html.
If false, the content should be escaped.
"""
template_name = 'dashboard/basic-text-widget.html'
def get_context_data(self, **kwargs):
title = kwargs.get('title', '(no title')
text = kwargs.get('text', '(no text)')
html = kwargs.get('html', False)
return {
'title': title,
'text': text
'text': text,
'html': html
}
register_widget('basic-text-widget', BasicTextWidget())
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