If the stats for the alert panel are absent (e.g. a StreamingHttpResponse) a KeyError is raised:
File "/my-project/.venv/lib/python3.12/site-packages/django/template/base.py", line 710, in resolve
obj = self.var.resolve(context)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/my-project/.venv/lib/python3.12/site-packages/django/template/base.py", line 842, in resolve
value = self._resolve_lookup(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/my-project/.venv/lib/python3.12/site-packages/django/template/base.py", line 885, in _resolve_lookup
current = getattr(current, bit)
^^^^^^^^^^^^^^^^^^^^^
File "/my-project/.venv/lib/python3.12/site-packages/debug_toolbar/panels/alerts.py", line 86, in nav_subtitle
alerts = self.get_stats()["alerts"]
^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'alerts'
``
If the stats for the alert panel are absent (e.g. a
StreamingHttpResponse
) aKeyError
is raised: