Skip to content

Commit 6cd5f8e

Browse files
committed
Lookup vendor on Django's connection wrapper
The vendor attribute does not exist on the underlying DB connection.
1 parent c7c97ae commit 6cd5f8e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

debug_toolbar/panels/sql/panel.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ def __init__(self, *args, **kwargs):
6767
def get_transaction_id(self, alias):
6868
if alias not in connections:
6969
return
70-
conn = connections[alias].connection
70+
connection = connections[alias]
71+
conn = connection.connection
7172
if not conn:
7273
return
7374

74-
if conn.vendor == "postgresql":
75+
if connection.vendor == "postgresql":
7576
cur_status = conn.get_transaction_status()
7677
else:
77-
raise ValueError(conn.vendor)
78+
raise ValueError(connection.vendor)
7879

7980
last_status = self._transaction_status.get(alias)
8081
self._transaction_status[alias] = cur_status

debug_toolbar/panels/sql/tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def _record(self, method, sql, params):
158158

159159
alias = self.db.alias
160160
conn = self.db.connection
161-
vendor = getattr(conn, "vendor", "unknown")
161+
vendor = self.db.vendor
162162

163163
# Sql might be an object (such as psycopg Composed).
164164
# For logging purposes, make sure it's str.

0 commit comments

Comments
 (0)