Skip to main content
๐Ÿ› Bug HuntDJ Django Hardโšก+35 XP

N+1 Query

This view runs 1 + N queries for N posts.

๐Ÿ› Find the bug
1posts = Post.objects.all()
2for post in posts:
3 print(post.author.name)
๐Ÿ› The bug is on line 1

๐Ÿ”ง Select the correct fix: