I\'m trying to optimize my ORM queries in django. I use connection.queries to view the queries that django generate for me.
Assuming I have these models:
<
Book.objects.select_related("author")
is good enough. No need for Author.objects.all()
Author.objects.all()
{{ book.author.name }}
won't hit the database, because book.author has been prepopulated already.
book.author