Skip to content

Commit 38314e2

Browse files
authored
Merge pull request #21 from StevenMapes/master
Django 3.1 through 4.1 compatibility changes
2 parents eaa8ee0 + f31f29f commit 38314e2

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

template_profiler_panel/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
default_app_config = "template_profiler_panel.apps.TemplateProfilerPanelAppConfig"
1+
import django
2+
if django.VERSION < (3, 2):
3+
default_app_config = "template_profiler_panel.apps.TemplateProfilerPanelAppConfig"

template_profiler_panel/panels/template.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@
55
import wrapt
66
from debug_toolbar.panels import Panel
77
from debug_toolbar.panels.sql.utils import contrasting_color_generator
8+
import django
89
from django.dispatch import Signal
9-
from django.utils.translation import ugettext_lazy as _
10-
11-
template_rendered = Signal(providing_args=[
12-
'instance', 'start', 'end', 'level', 'processing_timeline',
13-
])
1410

11+
if django.VERSION < (3, 2):
12+
from django.utils.translation import ugettext_lazy as _
13+
else:
14+
from django.utils.translation import gettext_lazy as _
15+
16+
if django.VERSION < (3, 1):
17+
template_rendered = Signal(providing_args=[
18+
'instance', 'start', 'end', 'level', 'processing_timeline',
19+
])
20+
else:
21+
template_rendered = Signal()
1522

1623
node_element_colors = {}
1724

0 commit comments

Comments
 (0)