Ok, so you could enumerate your Post
queryset so that you can insert an ad every x objects. This would make for a verbose and easily understandable approach.
Or you could do something with chain
from itertools
a bit like this;
>>> N = 5 # element to insert ad
>>> k = 'Ad' # Thing added to the list
>>>
>>> list(chain(*[letters[i : i+N] + [k] if len(letters[i : i+N]) == N else letters[i : i+N] for i in range(0, len(letters), N)]))
['a', 'b', 'c', 'd', 'e', 'Ad', 'f', 'g', 'h', 'i', 'j', 'Ad', 'k', 'l']
So as you can see there, an 'Ad' is added every 5 elements.
If you convert you two querysets into lists, you could do ads.pop()
to insert the element into the list of posts.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…