title: django: how to use many-to-many relationships in values()?
body: <p>i need to group results by a field that requires a few joins from the original model:</p>
  
  <pre><code>// response_filter_args is created dynamically
  responses = Response.objects.filter(**response_filter_args) \
          .values('customer__tags__tag') \                  # django doesn't like this
          .annotate(average_score=Avg('rating__score'))
  </code></pre>
  
  <p>Response -> customer -> tags (many-to-many field pointing to Tag) -> tag (the tag as a string)</p>
  
  <p>Models are:</p>
  
  <pre><code>class Response(models.Model):
      customer = models.ForeignKey(Customer)
      ...
  
  class Customer(models.Model):
      tags = models.ManyToManyField(Tag)
      ...
  
  class Tag(models.Model):
      tag = models.CharField(max_length=255)
      ...
  </code></pre>
  
  <p>i'm trying to calculate average ratings. to make it work i need to tell django to group by 'tag', but it refuses to. it gives an error:</p>
  
  <pre><code>Invalid field name: 'customer__tags__tag'
  </code></pre>
  
  <p>anyone know how i can get it to group by tag? i've tried all the combinations of underscores in customer_<em>tags</em>_tag that i can think of, but nothing works. </p>