title: Django group by dates and SUM values
body: <p>Is it possible to reproduce the following mysql query in Django without using select method ?</p>
  
  <pre><code>MariaDB [db1]&gt; SELECT datetime, SUM(datas) FROM table AND datetime BETWEEN '2013-07-26 13:00:00' AND '2013-07-26 23:00:00' GROUP BY datetime;
  </code></pre>
  
  <p>To get this kind of result :</p>
  
  <pre><code>+---------------------+-----------+
  | datetime            | SUM(data) |
  +---------------------+-----------+
  | 2013-07-26 13:00:00 |       489 |
  | 2013-07-26 14:00:00 |      2923 |
  | 2013-07-26 15:00:00 |       984 |
  | 2013-07-26 16:00:00 |      2795 |
  | 2013-07-26 17:00:00 |      1308 |
  | 2013-07-26 18:00:00 |      1365 |
  | 2013-07-26 19:00:00 |      1331 |
  | 2013-07-26 20:00:00 |       914 |
  | 2013-07-26 21:00:00 |       919 |
  | 2013-07-26 22:00:00 |       722 |
  | 2013-07-26 23:00:00 |       731 |
  +---------------------+-----------+
  11 rows in set (1.45 sec)
  </code></pre>
  
  <p>Edit: I got for now this kind of query :</p>
  
  <pre><code>&gt;&gt;&gt; value = table.objects.filter(datetime__range=('2013-07-26 13:00:00', 
   '2013-07-26 23:00:00')).values('datetime', 'data').annotate(Sum('data'))
  
  &gt;&gt;&gt; print value.query
  SELECT `table`.`datetime`, `table`.`data` SUM(`table`.`imps`) AS `data__sum`
   FROM `table`
  WHERE `table`.`datetime` BETWEEN 2013-07-26 13:00:00
  and 2013-07-26 23:00:00 GROUP BY `table`.`datetime`,
  `table`.`data` ORDER BY NULL
  </code></pre>
  
  <p>Why sum operate on both datetime and data?</p>
  
  <p>I tried to everywhere on django doc, here on stack but didn't find something coherent with my problem.
  Any suggestion ?</p>