To get the request in django, I can do:
>>> print User.objects.all().query SELECT `auth_user`.`id`, `auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`is_superuser`, `auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`
However, how can I get the query that it creates when executing COUNT?
>>> User.objects.all().count().query Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'int' object has no attribute 'query'
source share