File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ import warnings
12from inspect import iscoroutine
23
34from django .template .response import SimpleTemplateResponse
@@ -17,6 +18,17 @@ class RedirectsPanel(Panel):
1718
1819 nav_title = _ ("Intercept redirects" )
1920
21+ def __init__ (self , * args , ** kwargs ):
22+ super ().__init__ (* args , ** kwargs )
23+ warnings .warn (
24+ "The RedirectsPanel is deprecated and will be removed in a future version. "
25+ "The HistoryPanel now provides the ability to view toolbar data for redirected requests. "
26+ "If you still have a use case for this panel, please comment on "
27+ "https://github.com/django-commons/django-debug-toolbar/issues/2216" ,
28+ DeprecationWarning ,
29+ stacklevel = 2 ,
30+ )
31+
2032 def _process_response (self , response ):
2133 """
2234 Common response processing logic.
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ Pending
1515* Added ``CommunityPanel `` containing links to documentation and resources.
1616* Added how to generate the documentation locally to the contributing
1717 documentation.
18+ * Deprecated ``RedirectsPanel `` in favor of ``HistoryPanel `` for viewing
19+ toolbar data from redirected requests.
1820
19216.0.0 (2025-07-22)
2022------------------
Original file line number Diff line number Diff line change @@ -120,6 +120,13 @@ Redirects
120120
121121.. class :: debug_toolbar.panels.redirects.RedirectsPanel
122122
123+ .. deprecated :: 6.0
124+
125+ The RedirectsPanel is deprecated and will be removed in a future version.
126+ The HistoryPanel now provides the ability to view toolbar data for redirected
127+ requests. If you have a use case for this panel, please comment on the
128+ GitHub issue <https://github.com/django-commons/django-debug-toolbar/issues/2216>`_.
129+
123130When this panel is enabled, the debug toolbar will show an intermediate page
124131upon redirect so you can view any debug information prior to redirecting. This
125132page will provide a link to the redirect destination you can follow when
Original file line number Diff line number Diff line change 11import copy
2+ import warnings
23
34from django .conf import settings
45from django .http import HttpResponse
1213class RedirectsPanelTestCase (BaseTestCase ):
1314 panel_id = RedirectsPanel .panel_id
1415
16+ def setUp (self ):
17+ # Suppress the deprecation warning during setup
18+ with warnings .catch_warnings ():
19+ warnings .simplefilter ("ignore" , DeprecationWarning )
20+ super ().setUp ()
21+
1522 def test_regular_response (self ):
1623 not_redirect = HttpResponse ()
1724 self ._get_response = lambda request : not_redirect
@@ -100,3 +107,14 @@ def test_original_response_preserved(self):
100107 self .assertEqual (
101108 response .original_response .get ("Location" ), "http://somewhere/else/"
102109 )
110+
111+ def test_deprecation_warning (self ):
112+ """Test that a deprecation warning is shown when RedirectsPanel is instantiated."""
113+ from debug_toolbar .toolbar import DebugToolbar
114+
115+ with self .assertWarns (DeprecationWarning ) as cm :
116+ toolbar = DebugToolbar (self .request , self ._get_response )
117+ toolbar .get_panel_by_id (RedirectsPanel .panel_id )
118+
119+ self .assertIn ("RedirectsPanel is deprecated" , str (cm .warning ))
120+ self .assertIn ("HistoryPanel" , str (cm .warning ))
You can’t perform that action at this time.
0 commit comments