Skip to content

Commit 0b2fcf0

Browse files
committed
Made views for AJAX sub-panels CSRF exempt.
1 parent 24cb6fa commit 0b2fcf0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

debug_toolbar/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from django.db import connection
1111
from django.http import HttpResponseBadRequest
1212
from django.shortcuts import render_to_response
13+
from django.views.decorators.csrf import csrf_exempt
1314
from django.utils import simplejson
1415
from django.utils.hashcompat import sha_constructor
1516

@@ -26,6 +27,7 @@ def debug_media(request, path):
2627
root = os.path.join(parent, 'media', 'debug_toolbar')
2728
return django.views.static.serve(request, path, root)
2829

30+
@csrf_exempt
2931
def sql_select(request):
3032
"""
3133
Returns the output of the SQL SELECT statement.
@@ -58,6 +60,7 @@ def sql_select(request):
5860
return render_to_response('debug_toolbar/panels/sql_select.html', context)
5961
raise InvalidSQLError("Only 'select' queries are allowed.")
6062

63+
@csrf_exempt
6164
def sql_explain(request):
6265
"""
6366
Returns the output of the SQL EXPLAIN on the given query.
@@ -98,6 +101,7 @@ def sql_explain(request):
98101
return render_to_response('debug_toolbar/panels/sql_explain.html', context)
99102
raise InvalidSQLError("Only 'select' queries are allowed.")
100103

104+
@csrf_exempt
101105
def sql_profile(request):
102106
"""
103107
Returns the output of running the SQL and getting the profiling statistics.
@@ -141,6 +145,7 @@ def sql_profile(request):
141145
return render_to_response('debug_toolbar/panels/sql_profile.html', context)
142146
raise InvalidSQLError("Only 'select' queries are allowed.")
143147

148+
@csrf_exempt
144149
def template_source(request):
145150
"""
146151
Return the source of a template, syntax-highlighted by Pygments if

0 commit comments

Comments
 (0)