diff --git a/debug_toolbar/panels/redirects.py b/debug_toolbar/panels/redirects.py
index 8055c67ad..1db439723 100644
--- a/debug_toolbar/panels/redirects.py
+++ b/debug_toolbar/panels/redirects.py
@@ -1,3 +1,4 @@
+import warnings
from inspect import iscoroutine
from django.template.response import SimpleTemplateResponse
@@ -17,6 +18,17 @@ class RedirectsPanel(Panel):
nav_title = _("Intercept redirects")
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ warnings.warn(
+ "The RedirectsPanel is deprecated and will be removed in a future version. "
+ "The HistoryPanel now provides the ability to view toolbar data for redirected requests. "
+ "If you still have a use case for this panel, please comment on "
+ "https://github.com/django-commons/django-debug-toolbar/issues/2216",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+
def _process_response(self, response):
"""
Common response processing logic.
diff --git a/debug_toolbar/templates/debug_toolbar/redirect.html b/debug_toolbar/templates/debug_toolbar/redirect.html
index 46897846d..94f4eb7e8 100644
--- a/debug_toolbar/templates/debug_toolbar/redirect.html
+++ b/debug_toolbar/templates/debug_toolbar/redirect.html
@@ -4,8 +4,68 @@
Django Debug Toolbar Redirects Panel: {{ status_line }}
+
+
+
{% translate "WARNING:" %}
+ {% blocktranslate with issue_url="https://github.com/django-commons/django-debug-toolbar/issues/2216" %}
+ The RedirectsPanel is deprecated and will be removed in a future version. The HistoryPanel
+ now provides the ability to view toolbar data for redirected requests. If you still have a
+ use case for this panel, please comment on this
issue.
+ {% endblocktranslate %}
+
{{ status_line }}
diff --git a/docs/changes.rst b/docs/changes.rst
index 5c9b65fef..6e8cdcc8a 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -4,6 +4,9 @@ Change log
Pending
-------
+* Deprecated ``RedirectsPanel`` in favor of ``HistoryPanel`` for viewing
+ toolbar data from redirected requests.
+
6.1.0 (2025-10-30)
------------------
diff --git a/docs/panels.rst b/docs/panels.rst
index f2364ea7c..5f1b37b4f 100644
--- a/docs/panels.rst
+++ b/docs/panels.rst
@@ -120,6 +120,13 @@ Redirects
.. class:: debug_toolbar.panels.redirects.RedirectsPanel
+.. deprecated:: 6.0
+
+The RedirectsPanel is deprecated and will be removed in a future version.
+The HistoryPanel now provides the ability to view toolbar data for redirected
+requests. If you have a use case for this panel, please comment on the
+GitHub issue `_.
+
When this panel is enabled, the debug toolbar will show an intermediate page
upon redirect so you can view any debug information prior to redirecting. This
page will provide a link to the redirect destination you can follow when
diff --git a/tests/panels/test_redirects.py b/tests/panels/test_redirects.py
index c81c7eaba..86622b157 100644
--- a/tests/panels/test_redirects.py
+++ b/tests/panels/test_redirects.py
@@ -1,10 +1,12 @@
import copy
+import warnings
from django.conf import settings
from django.http import HttpResponse
from django.test import AsyncRequestFactory
from debug_toolbar.panels.redirects import RedirectsPanel
+from debug_toolbar.toolbar import DebugToolbar
from ..base import BaseTestCase
@@ -12,6 +14,12 @@
class RedirectsPanelTestCase(BaseTestCase):
panel_id = RedirectsPanel.panel_id
+ def setUp(self):
+ # Suppress the deprecation warning during setup
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ super().setUp()
+
def test_regular_response(self):
not_redirect = HttpResponse()
self._get_response = lambda request: not_redirect
@@ -100,3 +108,13 @@ def test_original_response_preserved(self):
self.assertEqual(
response.original_response.get("Location"), "http://somewhere/else/"
)
+
+ def test_deprecation_warning(self):
+ """Test that a deprecation warning is shown when RedirectsPanel is instantiated."""
+
+ with self.assertWarns(DeprecationWarning) as cm:
+ toolbar = DebugToolbar(self.request, self._get_response)
+ toolbar.get_panel_by_id(RedirectsPanel.panel_id)
+
+ self.assertIn("RedirectsPanel is deprecated", str(cm.warning))
+ self.assertIn("HistoryPanel", str(cm.warning))