Last Updated: October 06, 2019
·
1.445K
· puercopop

Making django-debug-toolbar display only for 'staff' users.

in settings.py (or local settings):

def show_toolbar_for_admin(request):
    if request.user.is_authenticated():
        return request.user.is_staff
    else:
        return False

DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TOOLBAR_CALLBACK': show_toolbar_for_admin

}