title: Django LEFT OUTER JOIN on TWO columns where one isn't a foreign key
body: <p>I have two models like so:</p>
  
  <pre><code>class ObjectLock(models.Model):
      partner = models.ForeignKey(Partner)
      object_id = models.CharField(max_length=100)
  
      class Meta:
          unique_together = (('partner', 'object_id'),)
  
  class ObjectImportQueue(models.Model):
      partner = models.ForeignKey(Partner)
      object_id = models.CharField(max_length=100)
      ... # other fields
      created = models.DateTimeField(auto_now_add = True)
      modified = models.DateTimeField(auto_now = True, db_index=True)
  
      class Meta:
          ordering = ('modified', 'created')
  </code></pre>
  
  <p>There is nothing notable about the third model mentioned above (Partner).</p>
  
  <p>I'd like to get something like:</p>
  
  <pre><code>SELECT * FROM ObjectImportQueue q LEFT OUTER JOIN ObjectLock l ON
  q.partner_id=l.partner_id AND q.object_id=l.object_id WHERE l.object_id
  IS NULL and l.partner_id IS NULL;
  </code></pre>
  
  <p>I came across <a href="http://www.caktusgroup.com/blog/2009/09/28/custom-joins-with-djangos-queryjoin/" rel="nofollow">this page</a> that tells how to do custom joins, and I tried passing in a tuple of the column names to join in place of the column name to join, and that didn't work. The Partner table shouldn't need to be included in the resulting sql query but I will accept an answer that does include it as long as it effectively does what I'm trying to do with one query.</p>