Skip to content
Advertisement

How to return related objects a queryset’s values_list instead of just the PKs

Is there a way to neatly return a queryset’s values_list of related objects from many objects’ related managers at the same time without having to write a loop ?

In other words this query:

JavaScript

will return me a list of PKs that will look something like this:

JavaScript

Is it possible to write such query that will return the actual objects instead of those PKs?

here are the models:

JavaScript

Advertisement

Answer

You can filter with:

JavaScript
Advertisement