views:

33

answers:

2

I want want to examine what django does with databse when I execute some statement with a django model
For instance

Group.members.all()

with manage.py shell.

Is there any way of doing this?

+2  A: 

You can use the Django Debug Toolbar.

Abe
+1. And for the shell, the debug toolbar adds an extra manage.py command - `debugsqlshell` that prints the SQL for every ORM command you type.
Daniel Roseman
A: 
print Group.members.all().query
Jason