summaryrefslogtreecommitdiff
path: root/django/template/context_processors.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/template/context_processors.py')
-rw-r--r--django/template/context_processors.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/template/context_processors.py b/django/template/context_processors.py
index d46cd3ec8f..5568ed9134 100644
--- a/django/template/context_processors.py
+++ b/django/template/context_processors.py
@@ -9,6 +9,8 @@ of a DjangoTemplates backend and used by RequestContext.
from __future__ import unicode_literals
+import itertools
+
from django.conf import settings
from django.middleware.csrf import get_token
from django.utils.encoding import smart_text
@@ -40,10 +42,13 @@ def debug(request):
context_extras = {}
if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:
context_extras['debug'] = True
- from django.db import connection
+ from django.db import connections
# Return a lazy reference that computes connection.queries on access,
# to ensure it contains queries triggered after this function runs.
- context_extras['sql_queries'] = lazy(lambda: connection.queries, list)
+ context_extras['sql_queries'] = lazy(
+ lambda: list(itertools.chain(*[connections[x].queries for x in connections])),
+ list
+ )
return context_extras