File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 1- from django .utils .translation import gettext_lazy as _
1+ from django .utils .translation import gettext_lazy as _ , ngettext
22
33from 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
You can’t perform that action at this time.
0 commit comments