Adventures in Freelancing
Hiding the Django Debug Toolbar in the Admin
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
}
| Print article | This entry was posted by clawlor on August 18, 2011 at 9:10 am, and is filed under Dev Tools, Django, Python. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |