diff options
| author | Aymeric Augustin | 2013-10-27 13:08:19 +0100 |
|---|---|---|
| committer | Aymeric Augustin | 2013-10-27 13:08:19 +0100 |
| commit | b979c164789facbaed84728de95300c2d01be61c (patch) | |
| tree | 7ca44f7842677e93ff7779e5541b2a09980c4196 | |
| parent | c0bd74252e717c4a93d333467253ef9b5c66dcb5 (diff) | |
| download | django-debug-toolbar-b979c164789facbaed84728de95300c2d01be61c.tar.bz2 | |
Document SQL_WARNING_THRESHOLD.
Fix #429.
| -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, } |
