From 2b6f551eb8da7edcac136888bc2ea0f676ceaca0 Mon Sep 17 00:00:00 2001 From: Chris Church Date: Thu, 31 Oct 2013 12:53:31 -0400 Subject: [PATCH] Add debug toolbar middleware before transaction middleware. --- awx/settings/defaults.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 0b16690641..c4a9f75446 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -212,9 +212,13 @@ EMAIL_USE_TLS = False try: import debug_toolbar INSTALLED_APPS += ('debug_toolbar',) - MIDDLEWARE_CLASSES += ( - 'debug_toolbar.middleware.DebugToolbarMiddleware', - ) + # Add debug toolbar middleware before Transaction middleware. + new_mc = [] + for mc in MIDDLEWARE_CLASSES: + if mc == 'django.middleware.transaction.TransactionMiddleware': + new_mc.append('debug_toolbar.middleware.DebugToolbarMiddleware') + new_mc.append(mc) + MIDDLEWARE_CLASSES = tuple(new_mc) except ImportError: pass