bakeries = Bakery.objects.annotate(hottest_cake_baked_at=Max('cake__baked_at'))
hottest_cakes = Cake.objects.filter(baked_at__in=[b.hottest_cake_baked_at for
    b in bakeries])
Django Query That Get Most Recent Objects From Different Categories