diff options
| author | bkonkle | 2011-09-15 10:26:00 -0500 | 
|---|---|---|
| committer | bkonkle | 2011-09-15 10:26:00 -0500 | 
| commit | ed9bca7c00f6f326842d79e843f678787fac8b15 (patch) | |
| tree | 11b5e740387ff96123b1e3d79db50d385085d4a5 /debug_toolbar | |
| parent | c20e83fc946c8898d40b0210f71286575891ae94 (diff) | |
| download | django-debug-toolbar-ed9bca7c00f6f326842d79e843f678787fac8b15.tar.bz2 | |
Add a default 'content' method, since the method is now identical on every panel
Diffstat (limited to 'debug_toolbar')
| -rw-r--r-- | debug_toolbar/panels/__init__.py | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index baebf02..e44d388 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -1,4 +1,5 @@  from django.template.defaultfilters import slugify +from django.template.loader import render_to_string  from debug_toolbar.middleware import DebugToolbarMiddleware @@ -6,7 +7,8 @@ class DebugPanel(object):      """      Base class for debug panels.      """ -    # name = Base +    # name = 'Base' +    # template = 'debug_toolbar/panels/base.html'      has_content = False # If content returns something, set to true in subclass      # We'll maintain a local context instance so we can expose our template @@ -38,7 +40,10 @@ class DebugPanel(object):          raise NotImplementedError      def content(self): -        raise NotImplementedError +        if self.has_content: +            context = self.context.copy() +            context.update(self.get_stats()) +            return render_to_string(self.template, context)      def record_stats(self, stats):          panel_stats = self.toolbar.stats.get(self.slug) | 
