From 03e1cc930c6a5fbe993fb120e4403f3dd8a7c211 Mon Sep 17 00:00:00 2001 From: Mounir Messelmeni Date: Sat, 9 Apr 2016 14:09:08 +0200 Subject: Fixed #26145 -- Made debug context processor return queries for all databases. --- tests/context_processors/templates/context_processors/debug.html | 4 ++++ tests/context_processors/tests.py | 2 ++ tests/context_processors/views.py | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/context_processors') diff --git a/tests/context_processors/templates/context_processors/debug.html b/tests/context_processors/templates/context_processors/debug.html index 671ab81372..076fa4cd87 100644 --- a/tests/context_processors/templates/context_processors/debug.html +++ b/tests/context_processors/templates/context_processors/debug.html @@ -12,4 +12,8 @@ Second query list: {{ sql_queries|length }} Third query list: {{ sql_queries|length }} +{% for obj in other_debug_objects.all %}{{ obj }}{% endfor %} + +Fourth query list: {{ sql_queries|length }} + {% endif %} diff --git a/tests/context_processors/tests.py b/tests/context_processors/tests.py index de25735b5c..f9c461cad9 100644 --- a/tests/context_processors/tests.py +++ b/tests/context_processors/tests.py @@ -87,3 +87,5 @@ class DebugContextProcessorTests(TestCase): self.assertContains(response, 'Second query list: 1') # Check we have not actually memoized connection.queries self.assertContains(response, 'Third query list: 2') + # Check queries for DB connection 'other' + self.assertContains(response, 'Fourth query list: 3') diff --git a/tests/context_processors/views.py b/tests/context_processors/views.py index 1a7eda0b16..354e842a8d 100644 --- a/tests/context_processors/views.py +++ b/tests/context_processors/views.py @@ -8,5 +8,8 @@ def request_processor(request): def debug_processor(request): - context = {'debug_objects': DebugObject.objects} + context = { + 'debug_objects': DebugObject.objects, + 'other_debug_objects': DebugObject.objects.using('other'), + } return render(request, 'context_processors/debug.html', context) -- cgit v1.3