1👍
Depending on the database used, you can work with .union(…)
[Django-doc]:
people = People.objects.none().union(*[
People.objects.filter(groups=group).all().order_by('?')[:n]
for group, n in zip(groups, proportion_pps)
])
Source:stackexchange.com