diff options
| author | Chris Adams | 2010-01-14 08:02:49 -0800 | 
|---|---|---|
| committer | Rob Hudson | 2010-01-14 08:02:49 -0800 | 
| commit | 4baa51e0be674428a2314e08efe43628184bc42a (patch) | |
| tree | d3584431a61ad1fbdf885e024950f472b89ff21e /debug_toolbar/panels/sql.py | |
| parent | fba93b813f90430545d5acaa25ef218f792360ab (diff) | |
| download | django-debug-toolbar-4baa51e0be674428a2314e08efe43628184bc42a.tar.bz2 | |
Template panel context cleanup.
All panels get a copy of the template context when created and use an updated
copy when rendering so they can have full access to context vars and avoid
making changes to the shared context.
Signed-off-by: Rob Hudson <rob@cogit8.org>
Diffstat (limited to 'debug_toolbar/panels/sql.py')
| -rw-r--r-- | debug_toolbar/panels/sql.py | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py index 7fa4423..1ac8445 100644 --- a/debug_toolbar/panels/sql.py +++ b/debug_toolbar/panels/sql.py @@ -137,7 +137,8 @@ class SQLDebugPanel(DebugPanel):      name = 'SQL'      has_content = True -    def __init__(self): +    def __init__(self, *args, **kwargs): +        super(self.__class__, self).__init__(*args, **kwargs)          self._offset = len(connection.queries)          self._sql_time = 0          self._queries = [] @@ -173,11 +174,13 @@ class SQLDebugPanel(DebugPanel):              query['start_offset'] = width_ratio_tally              width_ratio_tally += query['width_ratio'] -        context = { +        context = self.context.copy() +        context.update({              'queries': self._queries,              'sql_time': self._sql_time,              'is_mysql': settings.DATABASE_ENGINE == 'mysql', -        } +        }) +          return render_to_string('debug_toolbar/panels/sql.html', context)  def ms_from_timedelta(td): | 
