Skip to content
Snippets Groups Projects
Verified Commit 42a6b876 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Rewrite dt_show_toolbar to account for request objects without a user

parent ce304143
No related branches found
No related tags found
No related merge requests found
Pipeline #296 passed
......@@ -8,8 +8,16 @@ from django.http import HttpRequest
def dt_show_toolbar(request: HttpRequest) -> bool:
from debug_toolbar.middleware import show_toolbar # noqa
return settings.DEBUG and (show_toolbar(request) or request.user.is_superuser)
if not settings.DEBUG:
return False
if show_toolbar(request):
return True
elif hasattr(request, 'user') and request.user.is_superuser:
return True
return False
def get_app_packages() -> Sequence[str]:
""" Find all packages within the biscuit.apps namespace. """
......
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