Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

views.py 776B

12345678910111213141516171819202122
  1. from __future__ import absolute_import, unicode_literals
  2. from django.http import HttpResponse
  3. from django.utils.html import escape
  4. from django.utils.translation import ugettext as _
  5. from debug_toolbar.decorators import require_show_toolbar
  6. from debug_toolbar.toolbar import DebugToolbar
  7. @require_show_toolbar
  8. def render_panel(request):
  9. """Render the contents of a panel"""
  10. toolbar = DebugToolbar.fetch(request.GET['store_id'])
  11. if toolbar is None:
  12. content = _("Data for this panel isn't available anymore. "
  13. "Please reload the page and retry.")
  14. content = "<p>%s</p>" % escape(content)
  15. else:
  16. panel = toolbar.get_panel_by_id(request.GET['panel_id'])
  17. content = panel.content
  18. return HttpResponse(content)