Skip to content

Instantly share code, notes, and snippets.

@GeeWee
Created August 8, 2019 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeeWee/ac12ec3e914ed5d8321bfa3059374350 to your computer and use it in GitHub Desktop.
Save GeeWee/ac12ec3e914ed5d8321bfa3059374350 to your computer and use it in GitHub Desktop.
all_chefs = ItalianChef.objects.all()
for chef in all_chefs:
# Every time we reach the next line, we'll make an extra database call to fetch the
# favourite dish.
chefs_favourite_dish = chef.favourite_dish
print(f"{chef}'s favourite dish is {chefs_favourite_dish}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment