diff options
| author | Rob Hudson | 2008-09-12 13:34:39 -0700 |
|---|---|---|
| committer | Rob Hudson | 2008-09-12 13:34:39 -0700 |
| commit | ec38c74d20606182d9b9462977e185f0c37e99b2 (patch) | |
| tree | 8c16cbe575b123d7eda0ce60b4562524364e886f | |
| parent | 4056bf7fa4049190f103602d071be99a53846952 (diff) | |
| download | django-debug-toolbar-ec38c74d20606182d9b9462977e185f0c37e99b2.tar.bz2 | |
Moving default list of panels into the loader to skip an install step. Panel
list can still be overridden with a setting if desired. Updated README as
well.
| -rw-r--r-- | README.rst | 17 | ||||
| -rw-r--r-- | debug_toolbar/toolbar/loader.py | 18 |
2 files changed, 25 insertions, 10 deletions
@@ -41,10 +41,13 @@ Installation INTERNAL_IPS = ('127.0.0.1',) -#. Add a tuple called `DEBUG_TOOLBAR_PANELS` to your ``settings.py`` file that - specifies the full Python path to the panel that you want included in the - Toolbar. This setting looks very much like the `MIDDLEWARE_CLASSES` setting. - For example:: +#. Add `debug_toolbar` to your `INSTALLED_APPS` setting so Django can find the + the template files associated with the Debug Toolbar. + +#. Optional: Add a tuple called `DEBUG_TOOLBAR_PANELS` to your ``settings.py`` + file that specifies the full Python path to the panel that you want included + in the Toolbar. This setting looks very much like the `MIDDLEWARE_CLASSES` + setting. For example:: DEBUG_TOOLBAR_PANELS = ( 'debug_toolbar.panels.version.VersionDebugPanel', @@ -57,10 +60,8 @@ Installation ) You can change the ordering of this tuple to customize the order of the - panels you want to display. - -#. Add `debug_toolbar` to your `INSTALLED_APPS` setting so Django can find the - the template files associated with the Debug Toolbar. + panels you want to display. And you can include panels that you have created + or that are specific to your project. TODO ==== diff --git a/debug_toolbar/toolbar/loader.py b/debug_toolbar/toolbar/loader.py index 815c7f3..67dcc3e 100644 --- a/debug_toolbar/toolbar/loader.py +++ b/debug_toolbar/toolbar/loader.py @@ -10,15 +10,29 @@ class DebugToolbar(object): self.panels = [] self.panel_list = [] self.content_list = [] + # Override this tuple by copying to settings.py as `DEBUG_TOOLBAR_PANELS` + self.default_panels = ( + 'debug_toolbar.panels.version.VersionDebugPanel', + 'debug_toolbar.panels.timer.TimerDebugPanel', + 'debug_toolbar.panels.headers.HeaderDebugPanel', + 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', + 'debug_toolbar.panels.sql.SQLDebugPanel', + 'debug_toolbar.panels.cache.CacheDebugPanel', + 'debug_toolbar.panels.template.TemplateDebugPanel', + ) def load_panels(self): """ - Populate debug panel lists from settings.DEBUG_TOOLBAR_PANELS. + Populate debug panels """ from django.conf import settings from django.core import exceptions - for panel_path in settings.DEBUG_TOOLBAR_PANELS: + # Check if settings has a DEBUG_TOOLBAR_PANELS, otherwise use default + if hasattr(settings, 'DEBUG_TOOLBAR_PANELS'): + self.default_panels = settings.DEBUG_TOOLBAR_PANELS + + for panel_path in self.default_panels: try: dot = panel_path.rindex('.') except ValueError: |
