Skip to content

Commit ee837a3

Browse files
prevent debug toolbar from inserting itself into a partial template called via ajax. Prevents overwriting the current toolbar on the page and rendering the event listeners on toolbar panel buttons useless
1 parent 119874f commit ee837a3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

debug_toolbar/middleware.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def process_response(self, request, response):
118118
toolbar = self.__class__.debug_toolbars.get(ident)
119119
if not toolbar:
120120
return response
121+
if 'XMLHttpRequest' in request.META.get('HTTP_X_REQUESTED_WITH', ''):
122+
return response
121123
if isinstance(response, HttpResponseRedirect):
122124
if not toolbar.config['INTERCEPT_REDIRECTS']:
123125
return response

0 commit comments

Comments
 (0)