title: Django query to annotate number of foreign keys matching certain value
body: <p>If I had the following related models:</p>
  
  <pre><code>class User(models.Model):
      ...
  
  
  class Identity(models.Model):
      user = models.ForeignKey(User, on_delete=models.PROTECT)
      category = models.CharField(max_length=8, choices=IDENTITY_CATEGORIES)
      ...
  </code></pre>
  
  <p>How could I query for users with multiple <em>email</em> identities, where multiple <code>Identity</code> instances exist of category "email" which point to the same <code>User</code>.</p>
  
  <p>I've seen that <a href="https://docs.djangoproject.com/en/1.8/ref/models/conditional-expressions/" rel="nofollow">Django 1.8 introduced Conditional Expressions</a>, but I'm not sure how they would apply to this situation.</p>