title: Django newbie question: get count of associated ForeignKey, conditional on field within the ForeignKey table?
body: <p>Newbie question. I have Django models that look like this:</p>
  
  <pre><code>class Video(models.Model):
      uploaded_by = models.ForeignKey('VideoUser') 
      problem_video = models.BooleanField(default=False)
  class VideoUser(models.Model):
      name = models.CharField(max_length=250 )
      def num_videos(self):
          num_videos = Video.objects.filter(uploaded_by=self, problem_video=false).count()
          return num_videos
  </code></pre>
  
  <p>And I want to be able to produce a leaderboard of users who've uploaded at least one non-problem video, ordered by the number of non-problem videos they've uploaded.</p>
  
  <p>I can get part of the way there with <code>annotate</code> - I can produce an ordered list, but I don't know how to make it conditional on the <code>problem_video</code> field being False.</p>
  
  <pre><code> leaderboard = VideoUser.objects. \
              .annotate(num_submissions=Count('videosubmission')) \
              .filter(num_submissions__gt=0).order_by('-num_submissions')
  </code></pre>
  
  <p>Can anyone suggest how to extend this to take the <code>problem_video</code> field into account too? Maybe I need a bridging table...?</p>