HistoryPanel crashes when AJAX JSON response has items as one of the fields

Author: esperonus-karolisCreated Aug 26, 2026Updated Sep 7, 2026

The history_tr.html template currently has a loop

{% for key, value in history_context.history_stats.data.items %}

Here, history_context.history_stats.data is captured via HistoryPanel.generate_stats: if request content type is application/json, it loads the JSON body. If the result dictionary contains key items itself, it uses the dictionary value under that key instead of calling dictionary items() method. If the value is, say, a string, the loop crashes.

Source: django-commons/django-debug-toolbar