Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Django SQL dump middleware

View sqldump_middleware.py
1 2 3 4 5 6 7 8 9
from django.conf import settings
from django.db import connection
 
class SqldumpMiddleware(object):
def process_response(self, request, response):
if settings.DEBUG and 'sqldump' in request.GET:
response.content = str(connection.queries)
response['Content-Type'] = 'text/plain'
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.