[Django]-Multiple tables join on basis of foreign key in single query set in django?

4👍

Use select_related()

YourModel.objects.select_related().filter(foreign_record__foreign_attribute__gt=foo)

The select_related gets translated to INNER JOIN query and loads all the data immediately.

Leave a comment