In my Django app I have 2 querysets of the same object. I know I can merge 2 querysets using itertools and chain like so:
from itertools import chain
list(chain(first_queryset, second_queryset))
But this outputs a new queryset where the entire first one is followed by the entire second one like so:
[<first_queryset_1st_instance>, <first_queryset_2nd_instance>, <first_queryset_3rd_instance>, <second_queryset_1st_instance>, <second_queryset_2nd_instance>, <second_queryset_3rd_instance>]
However, I really need an output that is alternating between each queryset instead of just appending the entire second queryset at the end of the first one like so:
[<first_queryset_1st_instance>, <second_queryset_1st_instance>,<first_queryset_2nd_instance>, <second_queryset_2nd_instance>, <first_queryset_3rd_instance>, <second_queryset_3rd_instance>]
What's the best way I can do this in python/django?