title: Django/python date aggregation by month and quarter
body: <p>I'm writing a feature that requires the average price of an item over different times (week, month, quarter etc.) Here's the model:</p>
  
  <pre><code>class ItemPrice(models.Model):
      item = models.ForeignKey(Item)
      date = models.DateField()
      price = models.FloatField()
  </code></pre>
  
  <p>This model tracks the price of the item over time, with new Items being added at frequent, but not regular, intervals.
  Finding the average <code>price</code> over the last week is easy enough:</p>
  
  <pre><code>ItemPrice.objects.filter(item__id = 1)
      .filter(date_lt = TODAY)
      .filter(date_gte = TODAY_MINUS_7_DAYS)
      .filter(date_.aggregate(Avg('value'))
  </code></pre>
  
  <p>As a week always has 7 days, but what about month and quarter? They have different numbers of days...?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT:
  The app is for a finance org, 30-day months wont cut it I'm afraid, thanks for the suggestion!</p>