Skip to content

Commit 1243d26

Browse files
committed
Set dummy TasksPanel methods
1 parent fbfbd8d commit 1243d26

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

debug_toolbar/panels/tasks.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.utils.translation import gettext_lazy as _
1+
from django.utils.translation import gettext_lazy as _, ngettext
22

33
from debug_toolbar.panels import Panel
44

@@ -13,3 +13,27 @@ class TasksPanel(Panel):
1313
template = "debug_toolbar/panels/tasks.html"
1414

1515
is_async = True
16+
17+
def __init__(self, *args, **kwargs):
18+
super().__init__(*args, **kwargs)
19+
self.queued_tasks = []
20+
21+
@property
22+
def nav_subtitle(self):
23+
num_tasks = self.get_stats()["total_tasks"]
24+
return ngettext(
25+
"%(num_tasks)d task enqueued",
26+
"%(num_tasks)d tasks enqueued",
27+
num_tasks,
28+
) % {"num_tasks": num_tasks}
29+
30+
def generate_stats(self, request, response):
31+
stats = {"tasks": self.queued_tasks, "total_tasks": len(self.queued_tasks)}
32+
33+
self.record_stats(stats)
34+
35+
def enable_instrumentation(self):
36+
pass
37+
38+
def disable_instrumentation(self):
39+
pass

0 commit comments

Comments
 (0)