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.

decorators.py 385B

12345678910111213141516
  1. import functools
  2. from django.http import Http404
  3. def require_show_toolbar(view):
  4. @functools.wraps(view)
  5. def inner(request, *args, **kwargs):
  6. from debug_toolbar.middleware import get_show_toolbar
  7. show_toolbar = get_show_toolbar()
  8. if not show_toolbar(request):
  9. raise Http404
  10. return view(request, *args, **kwargs)
  11. return inner