Skip to content

Commit 0caa826

Browse files
committed
Only use postgres CursorDebugWrapper with Django 3
1 parent 59af30f commit 0caa826

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

debug_toolbar/management/commands/debugsqlshell.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from time import time
22

3+
import django
34
import sqlparse
45
from django.core.management.commands.shell import Command # noqa
56
from django.db import connection
67

7-
if connection.vendor == "postgresql":
8+
if connection.vendor == "postgresql" and django.VERSION >= (3, 0, 0):
89
from django.db.backends.postgresql import base as base_module
910
else:
1011
from django.db.backends import utils as base_module

tests/commands/test_debugsqlshell.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import io
22
import sys
33

4+
import django
45
from django.contrib.auth.models import User
56
from django.core import management
67
from django.db import connection
78
from django.test import TestCase
89
from django.test.utils import override_settings
910

10-
if connection.vendor == "postgresql":
11+
if connection.vendor == "postgresql" and django.VERSION >= (3, 0, 0):
1112
from django.db.backends.postgresql import base as base_module
1213
else:
1314
from django.db.backends import utils as base_module

0 commit comments

Comments
 (0)