Skip to content

Conversation

JohananOppongAmoateng
Copy link
Contributor

@JohananOppongAmoateng JohananOppongAmoateng commented Oct 12, 2025

Description

Please include a summary of the change and which issue is fixed. Please also
include relevant motivation and context. Your commit message should include
this information as well.

Fixes #2216

Checklist:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.


def test_deprecation_warning(self):
"""Test that a deprecation warning is shown when RedirectsPanel is instantiated."""
from debug_toolbar.toolbar import DebugToolbar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be a local import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No will change it

@tim-schilling
Copy link
Member

Originally I was thinking it would be a message on the template that gets rendered for the RedirectsPanel. I'm not sure it's a significant improvement over having it in the terminal.

@JohananOppongAmoateng
Copy link
Contributor Author

Should I include it in the template too?

@tim-schilling
Copy link
Member

@JohananOppongAmoateng I'm good with this as is. I wanted to raise it to see what you thought.

Copy link
Member

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I'd like another @django-commons/django-debug-toolbar-committers to approve of the idea (not necessarily the code) before I merge this in.

@elineda
Copy link
Member

elineda commented Oct 14, 2025

Hello,
It's ok for me but I'm agree with your first though @tim-schilling.

I think a message in the template it's not a lot of work and another warning for people who don't read the warning in console.

@JohananOppongAmoateng
Copy link
Contributor Author

JohananOppongAmoateng commented Oct 14, 2025

Mm that's true I will add a warning in the template. Should it be something like a toast?

@elineda
Copy link
Member

elineda commented Oct 14, 2025

Mm that's true I will add a warning in the template. Should it be something like a toast?

Yep only if the user is on the template ofc.

Copy link
Member

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new styles look pretty fixed with pixel units and static colors. This needs to be more flexible for both themes and people who adjust the zoom on the page. The classes also need to be prefixed with the toolbar id (see other styles). This prevents our styles from impacting application styles.

Copy link
Member

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest changes have caused the toolbar's side panel to disappear. I suspect it's due to trying to use the id="djDebug" attribute. My suggestion of using that as a prefix was wrong. This redirect HTML isn't actually within the toolbar's container, though we don't want custom styles floating around. We would need to identify a new container, like djdt-redirect. Though that said, I'm guessing that path is going to be more effort than we want to spend since this is deprecated. I think putting the styles in the <head> may be best. Though I wonder how that's going to go over with a CSP 😬

<link{% if toolbar.csp_nonce %} nonce="{{ toolbar.csp_nonce }}"{% endif %} rel="stylesheet" href="{% static 'debug_toolbar/css/toolbar.css' %}">
</head>
<body>
<body id="djDebug" {% if toolbar.store_id %}data-store-id="{{ toolbar.store_id }}"{% endif %}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The id="djDebug" seems to be causing downstream effects. I wonder if it'd be better to have the styles defined in the <head> here directly?

<body>
<body id="djDebug" {% if toolbar.store_id %}data-store-id="{{ toolbar.store_id }}"{% endif %}>
<div class="djdt-deprecation-warning">
<strong>{% translate "WARNING:" %}</strong> {% translate "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 <a href='https://github.com/django-commons/django-debug-toolbar/issues/2216'>issue</a>" %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<strong>{% translate "WARNING:" %}</strong> {% translate "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 <a href='https://github.com/django-commons/django-debug-toolbar/issues/2216'>issue</a>" %}
<strong>{% translate "WARNING:" %}</strong> {% translate "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 <a target='_blank' href='https://github.com/django-commons/django-debug-toolbar/issues/2216'>issue</a>" %}

I also think a {% blocktranslate %} may make this a bit more readable since you could add more linebreaks to the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retire RedirectsPanel in favor of HistoryPanel?

3 participants