Skip to content

Commit 25e9614

Browse files
jezdezrobhudson
authored andcommitted
Don't show the toolbar at all for ajax requests
Signed-off-by: Rob Hudson <rob@cogit8.org>
1 parent 960d1cf commit 25e9614

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

debug_toolbar/middleware.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,8 @@ def __init__(self):
4444
self.show_toolbar = show_toolbar_callback
4545

4646
def _show_toolbar(self, request):
47-
if not settings.DEBUG:
48-
return False
49-
if request.is_ajax() and not \
50-
request.path.startswith(os.path.join('/', debug_toolbar.urls._PREFIX)):
51-
# Allow ajax requests from the debug toolbar
52-
return False
53-
if not request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:
47+
if not request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS \
48+
or request.is_ajax() or not settings.DEBUG:
5449
return False
5550
return True
5651

0 commit comments

Comments
 (0)