title: Aggregate hourly count based on "HOUR" in datetime field in Django
body: <p>I am using Django 2.2 along with MySQL. I have the following query: 
  Here's the model for the reference : </p>
  
  <pre><code>class TrackCount(models.Model):
      people_count_obj_id = models.CharField(primary_key=True, default=uuid.uuid4,
                                             editable=False, max_length=255)
      recorded_at = models.DateTimeField()
      camera = models.ForeignKey(Camera, on_delete=models.PROTECT)
      store = models.ForeignKey(Store, on_delete=models.PROTECT)
      people_count_in = models.IntegerField()
      people_count_out = models.IntegerField()
      created_at = models.DateTimeField(auto_now=True)
      is_unique = models.BooleanField(default=False)
  
      def __str__(self):
          return "{}.{}.{}".format(self.people_count_in,
                                   self.people_count_out, str(self.store))
  
      class Meta:
          verbose_name = 'Track Count'
          verbose_name_plural = 'Track Counts'
  </code></pre>
  
  <p>========================================================
  My Query goes like this. </p>
  
  <pre><code>track_events = TrackCount.objects.filter(
              recorded_at__date=start_date.date(),
              recorded_at__hour__range=(8, 23),
              store__store_owner__id=self.kwargs['account_id']).order_by(
              'recorded_at'
          ).extra(
              select={
                  'hour': 'hour(recorded_at)'
              }
          ).values(
              'hour'
          ).annotate(
              TotalPeople=Sum('people_count_in')
          )
  </code></pre>
  
  <p>But when I check my records I get the output as following :</p>
  
  <pre><code>[
      {
          "hour": 17,
          "TotalPeople": 22
      },
      {
          "hour": 17,
          "TotalPeople": 19
      },
      {
          "hour": 17,
          "TotalPeople": 30
      },
      {
          "hour": 18,
          "TotalPeople": 33
      },
      {
          "hour": 18,
          "TotalPeople": 31
      },
      {
          "hour": 18,
          "TotalPeople": 32
      },
      {
          "hour": 19,
          "TotalPeople": 32
      },
      {
          "hour": 19,
          "TotalPeople": 21
  }] 
  </code></pre>
  
  <p>But I would like the output something like this : </p>
  
  <p><code>[{ "hour": 18, "TotalPeople": 96}....]</code> that is the record for same hour should be SUM-ed up together. </p>
  
  <p>Hope my point is clear. TIA </p>