title: Django Annotate - get list of distinct field values
body: <p>I have 3 models - <code>Book</code>, <code>Page</code> and <code>Language</code>. </p>
  
  <pre><code>class Book(models.Model):
      title = models.CharField(max_length=100)
      author = models.CharField(max_length=100)
  
  class Page(models.Model):
      image = models.ImageField(upload_to='Uploaded_images')
      language = models.ForiegnKey(Language, models.CASCADE)
      book = models.ForeignKey(Book, models.CASCADE)
  
  class Language(models.Model):
      name = models.CharField(max_length=20)
  </code></pre>
  
  <p>There's a one-to-many relationship between <code>Book</code> and <code>Page</code> objects. Some pages in a book can be of a different language, so I added the <code>ForeignKey</code> in <code>Page</code> model and not in the <code>Book</code> model.</p>
  
  <p>I want to get the list of all books along with the languages its pages were written in.</p>
  
  <p>I tried this:</p>
  
  <pre><code>books = Page.objects.annotate(
          name=F('book__title')
      ).values(
          'name', 'book_id'
      ).distinct(
      ).annotate(
          page_count=Count('id'),
      ).values(
          'name', 'book_id', 'language'
      )
  </code></pre>
  
  <p>If there are 2 languages in the book, I get 2 entries for the same book title. I just need 1 entry for the book and be able to show its languages as a list.</p>
  
  <p>Ex: If there's a book with pages in either of the 2 languages, Spanish and English, I'd like to extract the book title and the languages in it as ['English', 'Spanish'].</p>
  
  <p>Is this doable? </p>