diff options
| author | Aymeric Augustin | 2014-01-08 21:55:17 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2014-01-08 22:13:32 +0100 | 
| commit | fe6b2ce8c3db95367741012dce6a310cdd50266e (patch) | |
| tree | 0ec77a164cf2831a237573d3d212166d8f4c2ff0 /debug_toolbar/management/commands/debugsqlshell.py | |
| parent | c4224327f5e855d472d6f07316f374d209238411 (diff) | |
| download | django-debug-toolbar-fe6b2ce8c3db95367741012dce6a310cdd50266e.tar.bz2 | |
Allow the tests to run on Django 1.7.
Diffstat (limited to 'debug_toolbar/management/commands/debugsqlshell.py')
| -rw-r--r-- | debug_toolbar/management/commands/debugsqlshell.py | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py index 2d4bfa6..7e1471f 100644 --- a/debug_toolbar/management/commands/debugsqlshell.py +++ b/debug_toolbar/management/commands/debugsqlshell.py @@ -4,12 +4,15 @@ from time import time  # 'debugsqlshell' is the same as the 'shell'.  from django.core.management.commands.shell import Command               # noqa -from django.db.backends import util +try: +    from django.db.backends import utils +except ImportError: +    from django.db.backends import util as utils  import sqlparse -class PrintQueryWrapper(util.CursorDebugWrapper): +class PrintQueryWrapper(utils.CursorDebugWrapper):      def execute(self, sql, params=()):          start_time = time()          try: @@ -22,4 +25,4 @@ class PrintQueryWrapper(util.CursorDebugWrapper):              print('%s [%.2fms]' % (formatted_sql, duration)) -util.CursorDebugWrapper = PrintQueryWrapper +utils.CursorDebugWrapper = PrintQueryWrapper | 
