Django disk raskadrovka asboblar paneli orqali SQL so'rovlarini yozib oling

Men Django dasturini qo'mondonlik satridan kıvrımla chaqiraman. Men jsonni iltimosiga binoan va jsonda javob to'playapman.

Django disk raskadrovka asboblar paneli o'rnatilgan. SQL-ni asboblar paneli orqali ta'qib qilib, jsonning qolgan qismi bilan qaytarishim mumkinmi?

Bir narsa

@json_response
def index(request):
    try:
        ids = json.loads(request.read())['ids']
    except ValueError:
        return HttpResponseBadRequest

    listing = MyModel.public().filter(id__in=[c.split('-')[0] for c in ids])

    prep_list = [ l.details(request) for l in listing ]

    return {'status_code': 0,
            'status_text': 'success',
            'sql_query_list: DjangoDebugToolbar.sql()
            'prep_list': prep_list }

DjangoDebugToolbar.sql() o'rniga nima kiritishni istaganimni bilasizmi?

0

1 javoblar

Buni ko'ring:

from django.db impyokit connection  
connection.queries

oxirgi so'rovni bajarishingiz mumkin:

print connection.queries[-1]

yoki

print connection.queries.pop
3
qo'shib qo'ydi
Ajoyib, rahmat!
qo'shib qo'ydi muallif Mark L, manba