Skip to content

Cache panel work #1626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions debug_toolbar/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ class DebugToolbarConfig(AppConfig):
def ready(self):
from debug_toolbar.toolbar import DebugToolbar

# Import the panels when the app is ready. This allows panels
# like CachePanel to enable the instrumentation immediately.
DebugToolbar.get_panel_classes()
# Import the panels when the app is ready and call their ready() methods. This
# allows panels like CachePanel to enable their instrumentation immediately.
for cls in DebugToolbar.get_panel_classes():
cls.ready()


def check_template_config(config):
Expand Down
13 changes: 13 additions & 0 deletions debug_toolbar/panels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ def scripts(self):
"""
return []

# Panel early initialization

@classmethod
def ready(cls):
"""
Perform early initialization for the panel.

This should only include initialization or instrumentation that needs to
be done unconditionally for the panel regardless of whether it is
enabled for a particular request. It should be idempotent.
"""
pass

# URLs for panel-specific views

@classmethod
Expand Down
Loading