@@ -37,12 +37,20 @@ def __init__(self):
37
37
38
38
# Set method to use to decide to show toolbar
39
39
self .show_toolbar = self ._show_toolbar # default
40
+
41
+ # The tag to attach the toolbar to
42
+ self .tag = u'</body>'
43
+
40
44
if hasattr (settings , 'DEBUG_TOOLBAR_CONFIG' ):
41
45
show_toolbar_callback = settings .DEBUG_TOOLBAR_CONFIG .get (
42
46
'SHOW_TOOLBAR_CALLBACK' , None )
43
47
if show_toolbar_callback :
44
48
self .show_toolbar = show_toolbar_callback
45
49
50
+ tag = settings .DEBUG_TOOLBAR_CONFIG .get ('TAG' , None )
51
+ if tag :
52
+ self .tag = u'</' + tag + u'>'
53
+
46
54
def _show_toolbar (self , request ):
47
55
if not request .META .get ('REMOTE_ADDR' ) in settings .INTERNAL_IPS \
48
56
or request .is_ajax () or not settings .DEBUG :
@@ -83,6 +91,9 @@ def process_response(self, request, response):
83
91
for panel in self .debug_toolbars [request ].panels :
84
92
panel .process_response (request , response )
85
93
if response ['Content-Type' ].split (';' )[0 ] in _HTML_TYPES :
86
- response .content = replace_insensitive (smart_unicode (response .content ), u'</body>' , smart_unicode (self .debug_toolbars [request ].render_toolbar () + u'</body>' ))
94
+ response .content = replace_insensitive (
95
+ smart_unicode (response .content ),
96
+ self .tag ,
97
+ smart_unicode (self .debug_toolbars [request ].render_toolbar () + self .tag ))
87
98
del self .debug_toolbars [request ]
88
99
return response
0 commit comments