Optimizing QuerySets that involve related objects

Every time you retrieve an Action object, you will usually access its related User object and the user's related Profile object. The Django ORM offers a simple way to retrieve related objects at the same time thereby avoiding additional queries to the database.

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.