DJDT: fix 'HistoryEntry doesn't declare an explicit app_label'

Since we already established that the DJDT shouldn't be in-use
during tests: better be more complete in that attempt. The
thing that is the actual _fix_ is the MIDDLEWARE update.

See https://github.com/django-commons/django-debug-toolbar/issues/2167

See #168
This commit is contained in:
Klaas van Schelven
2025-07-25 20:03:01 +02:00
parent c5f9b1d593
commit c11ca5626c

View File

@@ -23,23 +23,21 @@ if not I_AM_RUNNING == "TEST":
"debug_toolbar",
]
MIDDLEWARE = [
"debug_toolbar.middleware.DebugToolbarMiddleware",
] + MIDDLEWARE
MIDDLEWARE = [
"debug_toolbar.middleware.DebugToolbarMiddleware",
] + MIDDLEWARE
def show_toolbar_for_queryparam(request):
# avoid "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."
from debug_toolbar.middleware import show_toolbar
def show_toolbar_for_queryparam(request):
# avoid "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."
from debug_toolbar.middleware import show_toolbar
if "__debug__" not in request.path and not request.GET.get("debug", ""):
return False
return show_toolbar(request)
if "__debug__" not in request.path and not request.GET.get("debug", ""):
return False
return show_toolbar(request)
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": show_toolbar_for_queryparam,
}
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": show_toolbar_for_queryparam,
}
# this way of configuring (DB, DB_USER, DB_PASSWORD) is specific to the development environment