Add SQL_DEBUG option that shows SQL queries Index: D:/web/projects/django-newforms/django/db/backends/util.py =================================================================== --- D:/web/projects/django-newforms/django/db/backends/util.py (revision 5753) +++ D:/web/projects/django-newforms/django/db/backends/util.py (working copy) @@ -19,6 +19,15 @@ return self.cursor.execute(sql, params) finally: stop = time() + from django.conf import settings + # If params was a list, convert it to a tuple, because string + # formatting with '%' only works with tuples or dicts. + if not isinstance(params, (tuple, dict)): + params = tuple(params) + if getattr(settings, 'SQL_DEBUG', False): + if not isinstance(params, (tuple, dict)): + params = tuple(params) + print '>', sql % params self.db.queries.append({ 'sql': smart_unicode(sql) % convert_args(params), 'time': "%.3f" % (stop - start),