Adventures in Freelancing
Posts tagged python
Hiding the Django Debug Toolbar in the Admin
Aug 18th
The Django Debug Toolbar is a an extremely helpful tool, but I find it a bit annoying in the admin. Thankfully, it only takes a few lines of code to blacklist the admin section.
Put this in your local_settings file (click the little ‘View Source’ icon in the upper right to easily cut & paste):
import re
def show_toolbar(request):
uri = request.get_full_path()
if re.match(r'/admin/', uri):
return False
return True
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': show_toolbar
}