merge two lists in python - but sort them during merge <p>i am querying from two models: </p> <pre><code>fq = MyModel.objects.order_by('-added_time') sq = MySecondModel.objects.order_by('-added_time') </code></pre> <p>say, querysets are: </p> <pre><code>1_1, 1_2, 1_3 2_1, 2_2, 2_3 </code></pre> <p>I want: </p> <pre><code>1_1, 2_1, 1_2, 2_2, 1_3, 2_3 </code></pre> <p>what I tried is: </p> <pre><code>all_res = list(fq) + list(sq) </code></pre> <p>but it is giving <code>1_1, 1_2, 1_3, 2_1, 2_2, 2_3</code></p> <p>what should i do to achieve what i want? I am using <code>paginator</code>, so the result should also be a queryset. </p> <p><strong>EDIT</strong>:</p> <p>this is how i am doing now: </p> <pre><code>fq= MyModel.objects.order_by('-added_time') sq = MySecondModel.objects.order_by('-added_time') all_res = sorted(chain(fq, sq),key=attrgetter('-added_time')) </code></pre> <p>and i have this type of pagination, where i set the left and right side distance in pages. </p> <p><img src="https://i.stack.imgur.com/bsJ7L.png" alt="enter image description here"></p> <p>this left and right distances i set as follows: </p> <pre><code>min = all_res.number - 5 max = all_res.number + 5 </code></pre> <p>and this lines are giving me error: <code>'list' object has no attribute 'number'</code> since <code>all_res</code> is a list. </p>