Created
May 5, 2020 16:57
-
-
Save readevalprint/7208c9e07f6ab391a8d9ac0908654f9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_debug_toolbar(request): | |
if request.__class__.__name__ == "AsgiRequest": | |
return ( | |
b"DEBUG" in request.scope["query_string"] | |
or "djdt=show" in request.META.get("HTTP_COOKIE", "") | |
) and (DEBUG or request.user.is_superuser) | |
s = ( | |
"DEBUG" in request.environ.get("QUERY_STRING", "") | |
or "djdt=show" in request.environ.get("HTTP_COOKIE", "") | |
) and (DEBUG or request.user.is_superuser) | |
return s | |
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": show_debug_toolbar} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment