diff options
| -rw-r--r-- | README.rst | 6 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/base.html | 2 | ||||
| -rw-r--r-- | debug_toolbar/toolbar/loader.py | 4 |
3 files changed, 10 insertions, 2 deletions
@@ -180,6 +180,12 @@ The debug toolbar has two settings that can be set in ``settings.py``: (The first value is ``socketserver`` on Python 3 and ``SocketServer`` on Python 2.) + * ``ROOT_TAG_ATTRS`` + + This setting is injected in the root template div in order to avoid conflicts + with client-side frameworks. For example, when using with Angular.js, set + this to 'ng-non-bindable' or 'class="ng-non-bindable"'. Defaults to ''. + Example configuration:: def custom_show_toolbar(request): diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index 7b42c84..cce2144 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -4,7 +4,7 @@ </style> <link rel="stylesheet" href="{{ STATIC_URL }}debug_toolbar/css/toolbar.min.css" type="text/css" /> <script type="text/javascript" src="{{ STATIC_URL }}debug_toolbar/js/toolbar.min.js"></script> -<div id="djDebug" style="display:none;" dir="ltr"> +<div id="djDebug" style="display:none;" dir="ltr" {{ TOOLBAR_ROOT_TAG_ATTRS|safe }}> <div style="display:none;" id="djDebugToolbar"> <ul id="djDebugPanelList"> {% if panels %} diff --git a/debug_toolbar/toolbar/loader.py b/debug_toolbar/toolbar/loader.py index 5b55149..491f66c 100644 --- a/debug_toolbar/toolbar/loader.py +++ b/debug_toolbar/toolbar/loader.py @@ -18,7 +18,8 @@ class DebugToolbar(object): base_url = self.request.META.get('SCRIPT_NAME', '') self.config = { 'INTERCEPT_REDIRECTS': False, - 'MEDIA_URL': '%s/__debug__/m/' % base_url + 'MEDIA_URL': '%s/__debug__/m/' % base_url, + 'ROOT_TAG_ATTRS': '', } # Check if settings has a DEBUG_TOOLBAR_CONFIG and updated config self.config.update(getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {})) @@ -26,6 +27,7 @@ class DebugToolbar(object): 'BASE_URL': base_url, # for backwards compatibility 'DEBUG_TOOLBAR_MEDIA_URL': self.config.get('MEDIA_URL'), 'STATIC_URL': settings.STATIC_URL, + 'TOOLBAR_ROOT_TAG_ATTRS': self.config.get('ROOT_TAG_ATTRS'), } self.load_panels() |
