title: How do I get the related objects In an extra().values() call in Django?
body: <p>Thank to this post I'm able to easily do count and group by queries in a Django view:</p>
  
  <p><a href="https://stackoverflow.com/questions/327807/django-equivalent-for-count-and-group-by">Django equivalent for count and group by</a></p>
  
  <p>What I'm doing in my app is displaying a list of coin types and face values available in my database for a country, so coins from the UK might have a face value of "1 farthing" or "6 pence".  The <code>face_value</code> is the 6, the <code>currency_type</code> is the "pence", stored in a related table.</p>
  
  <p>I have the following code in my view that gets me 90% of the way there:</p>
  
  <pre><code>def coins_by_country(request, country_name):
      country = Country.objects.get(name=country_name)
      coin_values = Collectible.objects.filter(country=country.id, type=1).extra(select={'count': 'count(1)'},
                                 order_by=['-count']).values('count', 'face_value', 'currency_type')
      coin_values.query.group_by = ['currency_type_id', 'face_value']
      return render_to_response('icollectit/coins_by_country.html', {'coin_values': coin_values, 'country': country } )
  </code></pre>
  
  <p>The <code>currency_type_id</code> comes across as the number stored in the foreign key field (i.e. 4).  What I want to do is retrieve the actual object that it references as part of the query (the Currency model, so I can get the Currency.name field in my template).</p>
  
  <p>What's the best way to do that?</p>