diff options
| -rw-r--r-- | README.rst | 5 | ||||
| -rw-r--r-- | debug_toolbar/utils/settings.py | 1 | ||||
| -rw-r--r-- | debug_toolbar/utils/tracking/db.py | 2 | 
3 files changed, 7 insertions, 1 deletions
| @@ -186,6 +186,11 @@ The debug toolbar has two settings that can be set in ``settings.py``:       with client-side frameworks. For example, when using with Angular.js, set       this to 'ng-non-bindable' or 'class="ng-non-bindable"'. Defaults to ''. +   * ``SQL_WARNING_THRESHOLD`` + +     The SQL panel highlights queries that took more that this amount of time, +     in milliseconds, to execute. The default is 500. +     Example configuration::         def custom_show_toolbar(request): diff --git a/debug_toolbar/utils/settings.py b/debug_toolbar/utils/settings.py index 482781b..af9821f 100644 --- a/debug_toolbar/utils/settings.py +++ b/debug_toolbar/utils/settings.py @@ -19,6 +19,7 @@ CONFIG_DEFAULTS = {          'debug_toolbar',      ),      'ROOT_TAG_ATTRS': '', +    'SQL_WARNING_THRESHOLD': 500,   # milliseconds  } diff --git a/debug_toolbar/utils/tracking/db.py b/debug_toolbar/utils/tracking/db.py index 7b8092c..dd49e39 100644 --- a/debug_toolbar/utils/tracking/db.py +++ b/debug_toolbar/utils/tracking/db.py @@ -135,7 +135,7 @@ class NormalCursorWrapper(object):                  'stacktrace': stacktrace,                  'start_time': start_time,                  'stop_time': stop_time, -                'is_slow': (duration > CONFIG.get('SQL_WARNING_THRESHOLD', 500)), +                'is_slow': duration > CONFIG['SQL_WARNING_THRESHOLD'],                  'is_select': sql.lower().strip().startswith('select'),                  'template_info': template_info,              } | 
