title: Django: filtering models on the difference of Counts of related models
body: <p>I've got a bunch of Order objects, each connected to one or more OrderRow objects (visible as a reverse relation to their parent Orders with Order.order_rows.all()).</p>
  
  <p>Each OrderRow has a <b>collection_status</b> attribute, which can be 'collected', 'uncollected' or a bunch of other special values. Each Order has a <b>status</b> attribute, one of the valid values being 'processing'.</p>
  
  <p>I'm at a loss trying to build an Order QuerySet that lists Order objects with the following criteria: Order status is 'processing', the count of its <code>collection_status='collected'</code> OrderRows is less than the total count of its OrderRows. Orders that have been not at all collected or partially collected, but not fully collected, that is.</p>
  
  <p>To put it in an explicit way:</p>
  
  <p>Order with two rows, both 'uncollected': included in the QS<br>
  Order with three rows, one 'collected', two 'uncollected': included in the QS<br>
  Order with two rows, both 'collected': NOT included in the QS!</p>
  
  <p>(You can replace 'uncollected' with any other value that isn't 'collected' and the criteria is still the same; it's 'collected' vs. any other collection_status)</p>
  
  <p>I've gotten as far as Order.objects.filter(status__exact='processing'), but beyond that, all my attempts at annotations, Q() objects etc. have failed miserably.</p>