links to django's docs on select_related and prefetch_related.