@@ -99,6 +99,7 @@ def process_request(self, request):
99
99
toolbar = DebugToolbar (request )
100
100
for panel in toolbar .panels :
101
101
panel .process_request (request )
102
+
102
103
self .__class__ .debug_toolbars [thread .get_ident ()] = toolbar
103
104
104
105
def process_view (self , request , view_func , view_args , view_kwargs ):
@@ -116,8 +117,22 @@ def process_view(self, request, view_func, view_args, view_kwargs):
116
117
def process_response (self , request , response ):
117
118
__traceback_hide__ = True
118
119
ident = thread .get_ident ()
120
+
119
121
toolbar = self .__class__ .debug_toolbars .get (ident )
122
+
120
123
if not toolbar or request .is_ajax ():
124
+ for panel in toolbar .panels :
125
+ panel .process_response (request , response )
126
+
127
+ rendered = toolbar .render_toolbar ()
128
+ from django .utils import simplejson
129
+ rendered = simplejson .dumps ({'rendered' :rendered })
130
+
131
+ if '{replace}' not in response .content :
132
+ if response .content [- 1 ] == '}' :
133
+ response .content = response .content [:- 1 ] + ', "replace":"{replace}"}'
134
+
135
+ response .content = response .content .replace ('"{replace}"' , rendered )
121
136
return response
122
137
if isinstance (response , HttpResponseRedirect ):
123
138
if not toolbar .config ['INTERCEPT_REDIRECTS' ]:
0 commit comments