Suppose I have two models, A and B, where an A can have multiple Bs related to it. Given a QuerySet of A objects, how can I create a QuerySet containing all the B objects related to all these A objects?
For those who also happen to speak LINQ, I want something like this:
queryableOfA.SelectMany(a => a.Bs)
Even better would be an example of how to chain A -> B -> C, i.e. the following LINQ:
queryableOfA.SelectMany(a => a.Bs).SelectMany(b => b.Cs)
(returning a "queryset" of all C objects related to all the A objects through B)