diff --git a/django/website/dashboard/templates/dashboard/basic-text-widget.html b/django/website/dashboard/templates/dashboard/basic-text-widget.html index 9d8316631a93455da5a0a9ea7b4c7753f3110ba1..035835361b857818aa1920eedb6ae2c53e9149f6 100644 --- a/django/website/dashboard/templates/dashboard/basic-text-widget.html +++ b/django/website/dashboard/templates/dashboard/basic-text-widget.html @@ -4,6 +4,10 @@ {{ title }} </div> <div class='panel-body'> - {{ text }} + {% if html %} + {{ text|safe }} + {% else %} + {{ text }} + {% endif %} </div> </div> diff --git a/django/website/dashboard/widget_pool.py b/django/website/dashboard/widget_pool.py index 4dcece56d50085b02944761d9a65837d5bf794e3..7615b0bb5cb4fbccddd2acc08db5208ba15f47e4 100644 --- a/django/website/dashboard/widget_pool.py +++ b/django/website/dashboard/widget_pool.py @@ -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())