diff options
| -rw-r--r-- | debug_toolbar/middleware.py | 6 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/base.html | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 9170398..9c8581c 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -10,7 +10,8 @@ from debug_toolbar.toolbar.loader import DebugToolbar _HTML_TYPES = ('text/html', 'application/xhtml+xml') _END_HEAD_RE = re.compile(r'</head>', re.IGNORECASE) -_END_BODY_RE = re.compile(r'<body([^<]*)>', re.IGNORECASE) +_START_BODY_RE = re.compile(r'<body([^<]*)>', re.IGNORECASE) +_END_BODY_RE = re.compile(r'</body>', re.IGNORECASE) class DebugToolbarMiddleware(object): """ @@ -54,5 +55,6 @@ class DebugToolbarMiddleware(object): if response['Content-Type'].split(';')[0] in _HTML_TYPES: # Saving this here in case we ever need to inject into <head> #response.content = _END_HEAD_RE.sub(smart_str(self.debug_toolbar.render_styles() + "%s" % match.group()), response.content) - response.content = _END_BODY_RE.sub(smart_str('<body\\1>' + self.debug_toolbar.render_toolbar()), response.content) + response.content = _START_BODY_RE.sub(smart_str('<body\\1>' + self.debug_toolbar.render_toolbar()), response.content) + response.content = _END_BODY_RE.sub(smart_str('<script src="' + request.META.get('SCRIPT_NAME', '') + '/__debug__/m/toolbar.js" type="text/javascript" charset="utf-8"></script></body>'), response.content) return response diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index e654219..e1d66c5 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -1,5 +1,4 @@ <script src="{{ BASE_URL }}/__debug__/m/jquery.js" type="text/javascript" charset="utf-8"></script> -<script src="{{ BASE_URL }}/__debug__/m/toolbar.js" type="text/javascript" charset="utf-8"></script> <style type="text/css"> @import url({{ BASE_URL }}/__debug__/m/toolbar.css); </style> |
