No. A query set is a representation of a query β hence, a name is not an arbitrary set of instances.
If you really need the actual set of queries, not a list, you can try to collect the identifiers of the objects you need, and then get the objects through the __in request:
list_of_ids = [] list_of_ids.append(my_id) ... queryset = MyModel.objects.filter(id__in=list_of_ids)
It is not very effective.
source share