Because I need to avoid a recursive import and work with a Group
object as my starting point for my query (which is why I can't import Action
objects directly.)
The relationship is Group
-> Component
-> ComponentVersion
-> Action
For instance, Group.components.all()
returns all the components in a query set.
Additionally [component.versions.all() for component in Group.components.all()]
returns a list of Querysets whose results are all of the versions. Subsequently, .actions.all()
would return all the Queryset of actions
for each ComponentVersion
returned in the comprehension.
What is the optimal way to do this to avoid making unnecessary calls to the DB and for readability?