Skip to content

Added the ability to disable toolbar on a per request basis with a query parameter. #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ If you have ideas for other panels please let us know.

* Note: The Debug Toolbar only works on Django 1.2 and newer.

To disable the toolbar on a per request basis, add DISABLE to the query string::

http://domain.com/path?DISABLE=disable


Installation
============

Expand Down
3 changes: 3 additions & 0 deletions debug_toolbar/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def _show_toolbar(self, request):
if getattr(settings, 'TEST', False):
return False

if request.REQUEST.get('DISABLE', False):
return False

x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR', None)
if x_forwarded_for:
remote_addr = x_forwarded_for.split(',')[0].strip()
Expand Down