From 50ec9c1b979abd765e7b0f6d0cfa4e24cff18834 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Wed, 18 Feb 2009 15:48:12 +1100 Subject: Fixed "FROM" formatting in SQL panel layout. We always start a new line for "FROM" now. Previous code was assuming MySQL quoting of identifiers (MySQL is a bit non-standard in using backquotes) and was assuming the last thing before the FROM would be a quoted identifier, which wasn't always true, particularly when extra() is used on querysets. Signed-off-by: Rob Hudson --- debug_toolbar/panels/sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debug_toolbar/panels/sql.py') diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py index 7396c3a..1aa42f7 100644 --- a/debug_toolbar/panels/sql.py +++ b/debug_toolbar/panels/sql.py @@ -73,7 +73,7 @@ class SQLDebugPanel(DebugPanel): def reformat_sql(sql): sql = sql.replace('`,`', '`, `') sql = sql.replace('SELECT ', 'SELECT\n\t') - sql = sql.replace('` FROM ', '`\nFROM\n\t') + sql = sql.replace(' FROM ', '\nFROM\n\t') sql = sql.replace(' WHERE ', '\nWHERE\n\t') sql = sql.replace(' INNER JOIN ', '\nINNER JOIN\n\t') sql = sql.replace(' LEFT OUTER JOIN ', '\nLEFT OUTER JOIN\n\t') -- cgit v1.2.3