title: Calculating an average over groups in django
body: <p>I would like to know in Django how to get the average number of grouped elements in my table per element (without using .extra(...) if possible).</p>
  
  <p>Concretely I have a table (DwarvesEatingCakes) consisting of Dwarves and Cakes. Each pair (dwarf, cake) is unique. I want to get the average number of cakes eaten by each dwarf.</p>
  
  <p>The following code does not seem to work:</p>
  
  <pre><code>avg_cakeeaten_dict = DwarvesEatingCakes.values('dwarf').annotate(num_cake=Count('cake')).aggregate(avg_cake_eaten=Avg('num_cake'))
  </code></pre>
  
  <p>Thanks for the help!</p>