summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/backends/util.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/backends/util.py b/django/db/backends/util.py
index b9c6f573c9..3098a53556 100644
--- a/django/db/backends/util.py
+++ b/django/db/backends/util.py
@@ -12,6 +12,10 @@ class CursorDebugWrapper:
return self.cursor.execute(sql, params)
finally:
stop = time()
+ # 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)
self.db.queries.append({
'sql': sql % tuple(params),
'time': "%.3f" % (stop - start),