title: How can I do to get the entries in an array?
body: <p>Hello I have a Django query which contains this data :</p>
  <pre><code>id country begin               end
  1  US      2020-10-07 15:30    2020-10-07 16:30
  2  US      2020-10-07 16:30    2020-10-07 18:00
  3  US      2020-10-07 19:00    2020-10-07 20:00
  4  SP      2020-10-08 15:30    2020-10-08 17:30
  5  SP      2020-10-08 17:30    2020-10-08 18:30
  </code></pre>
  <p>And using Django I would like to put in an array the data like this :</p>
  <pre><code>[{'country':'US', 'begin':'2020-10-07 15:30'; 'end':'2020-10-07 18:00'}, 
   {'country':'US', 'begin':'2020-10-07 19:00'; 'end':'2020-10-07 20:00'}, 
   {'country':'SP', 'begin':'2020-10-08 15:30'; 'end':'2020-10-08 18:30'}] 
  </code></pre>
  <p>I get my table with the following query :</p>
  <pre><code>myTable = Table.objects.all().order_by('begin')
  </code></pre>
  <p>For the two first lines I don't know how to implement that... Basically I want if the country is the same and if one end 1 is equals to one begin 2 I want to put this in a same element in my array with begin 1 and end 2.</p>
  <p>The line 3 stay like that because the begin 2020-10-07 19:00 is not equals to 2020-10-07 18:00
  nor 2020-10-07 16:30 and the end 2020-10-07 20:00 is not equals to 2020-10-07 15:30 nor 2020-10-07 16:30.</p>
  <p>For the fourth and fifth line we noticed the country are not US but SP. Then, the end of the fourth line is 2020-10-08 17:30 and the begin of the fifth line is 2020-10-08 17:30  so we can put this also in a same element.</p>
  <p>Could you help me please ?</p>
  <p>Thank you very much !</p>