I have a model X, containing a ManyToManyField Y, I’m trying to concatenate the results of a querySet of X‘s into a list of all the entries in Y
I know the “easy” way would be:
for x in X:
for y in x.Y.all():
list.append(y)
The reasoning to this is related to my previous question:
If x in <listOfModels.field> syntax
Thanks in advance,
Turn the query around. You’re interested in Ys, so you should query Ys.