1from django.conf import settings
2settings.DEBUG = True
3from django.db import connection, reset_queries
4
5
6def num_queries(reset=True):
7 print(len(connection.queries))
8 if reset:
9 reset_queries()
10
1from django.conf import settings
2settings.DEBUG = True
3from django.db import connection
4Model.objects.count()
5# python 3 uses print()
6print(len(connection.queries))
71
8