title: complex query in django where subquery exists
body: <p>I have a table with many records and am trying to create a complex query and hoping for some help here. </p>
  
  <p>models.py</p>
  
  <pre><code>class Vote(models.Model):
      is_annonymous   = models.BooleanField(default=True)
      vote            = models.IntegerField()
  
      created_by        = models.ForeignKey(User, null=True, blank=True)
      created_at        = models.DateTimeField(null=True, blank=True)
      ip_address        = models.IPAddressField(null=True, blank=True)
  
  
      #content type
      content_type    = models.ForeignKey(ContentType)
      object_id       = models.PositiveIntegerField()
      content_object  = generic.GenericForeignKey('content_type', 'object_id')
  </code></pre>
  
  <p>query</p>
  
  <pre><code>all_votes = Vote.objects.filter(
      ~Q(created_by   = None),
  )
  </code></pre>
  
  <p>Am trying to return records from Vote where created_by is not null and created_by made his first vote. Meaning, I want to only return the Vote record if user made his first vote.</p>
  
  <p>Am not sure how to do such a thing, usually, on SQL, I would have to do a sub query and count the user votes and if they are equal one then return the record. </p>
  
  <p>Any idea how would I do that with django models?</p>