title: Getting all unique values stored in a many-to-many field
body: <p>I have a many-to-many field called <code>categories</code> and I would like to get distinct values stored in that field.</p>
  
  <p>The following is my model:</p>
  
  <pre><code>class Book (models.Model):
      categories=models.ManyToManyField(Category, related_name = 'categories', blank = True, null=True)
  </code></pre>
  
  <p>Here is my Category model:</p>
  
  <pre><code>class Category (MPTTModel):
      category = models.CharField(max_length=250)
      parent = TreeForeignKey('self', blank=True, null=True, related_name='children')
  </code></pre>
  
  <p>I'd like to get every single one of the categories related to a book. How would I do this?</p>