Skip to content

Commit 3e4c484

Browse files
committed
Make template panel serializable.
The stats must be stored as JSON, otherwise it'll be converted to a string.
1 parent 16e02f5 commit 3e4c484

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

debug_toolbar/panels/templates/panel.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def title(self):
112112
def nav_subtitle(self):
113113
templates = self.get_stats()["templates"]
114114
if templates:
115-
return self.templates[0]["template"].name
115+
return templates[0]["template"]["name"]
116116
return ""
117117

118118
template = "debug_toolbar/panels/templates.html"
@@ -196,7 +196,11 @@ def generate_stats(self, request, response):
196196
else:
197197
template.origin_name = _("No origin")
198198
template.origin_hash = ""
199-
info["template"] = template
199+
info["template"] = {
200+
"name": template.name,
201+
"origin_name": template.origin_name,
202+
"origin_hash": template.origin_hash,
203+
}
200204
# Clean up context for better readability
201205
if self.toolbar.config["SHOW_TEMPLATE_CONTEXT"]:
202206
if "context_list" not in template_data:

0 commit comments

Comments
 (0)