File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11from django .template .defaultfilters import slugify
2+ from django .template .loader import render_to_string
23from debug_toolbar .middleware import DebugToolbarMiddleware
34
45
56class DebugPanel (object ):
67 """
78 Base class for debug panels.
89 """
9- # name = Base
10+ # name = 'Base'
11+ # template = 'debug_toolbar/panels/base.html'
1012 has_content = False # If content returns something, set to true in subclass
1113
1214 # We'll maintain a local context instance so we can expose our template
@@ -38,7 +40,10 @@ def url(self):
3840 raise NotImplementedError
3941
4042 def content (self ):
41- raise NotImplementedError
43+ if self .has_content :
44+ context = self .context .copy ()
45+ context .update (self .get_stats ())
46+ return render_to_string (self .template , context )
4247
4348 def record_stats (self , stats ):
4449 panel_stats = self .toolbar .stats .get (self .slug )
You can’t perform that action at this time.
0 commit comments