We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a8ffb63 + 0672df7 commit 783781cCopy full SHA for 783781c
debug_toolbar/middleware.py
@@ -5,6 +5,7 @@
5
import re
6
from functools import lru_cache
7
8
+import django
9
from django.conf import settings
10
from django.utils.module_loading import import_string
11
@@ -48,7 +49,11 @@ def __call__(self, request):
48
49
# Decide whether the toolbar is active for this request. Don't render
50
# the toolbar during AJAX requests.
51
show_toolbar = get_show_toolbar()
- if not show_toolbar(request) or request.is_ajax():
52
+ if not show_toolbar(request) or (
53
+ request.is_ajax()
54
+ if django.VERSION < (3, 1)
55
+ else not request.accepts("text/html")
56
+ ):
57
return self.get_response(request)
58
59
toolbar = DebugToolbar(request, self.get_response)
0 commit comments