I have models like this
Model Trip:
hotel: m2m_field to Hotel
flight: m2m_field to Flight
Model Hotel:
city: foreignkey to City
Model Flight:
city: foreignkey to City
The problem is when I do
Trip.objects.prefetch_related('hotel__city', 'flight__city')
It generates 5 sql queries: 1 on Trip, 1 on Hotel, 1 on Flight, 1 on City from Hotel result, and 1 on City from Flight result. Can I reduce the last two queries on City table into 1? I think I may be asking too much from ORM, but just want to know whether it's possible either in ORM or raw-query.